resultset - performance difference - get(1) vs get("col_name")

T

Tim B

I'm looking for performance comparisons between rs.get(1) vs
rs.get("col_name") where rs is a java.sql.Resultset, and the database is
Oracle. So far I haven't found any that provide hard numbers - such as, e.g.
"rs.get("col_name") took 2.3 times as long as rs.get(1)".

Does anyone have a link to such a comparison?

Thanks,
Tim B
 
L

Lothar Kimmeringer

Tim said:
I'm looking for performance comparisons between rs.get(1) vs
rs.get("col_name") where rs is a java.sql.Resultset, and the database is
Oracle. So far I haven't found any that provide hard numbers - such as, e.g.
"rs.get("col_name") took 2.3 times as long as rs.get(1)".

Does anyone have a link to such a comparison?

I'm not aware of any and the comparison would only be valid
for one specific version of one specific JDBC-driver for one
specific database (Resultset is only an interface, the
implementation is driver-specific).

But assuming that all implementations are using a map
for getting the column of a specific name, the performance-
difference shouldn't be that big.

But you're invited to do the test and tell us the results.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 
L

Lew

Lothar said:
I'm not aware of any and the comparison would only be valid
for one specific version of one specific JDBC-driver for one
specific database (Resultset is only an interface, the
implementation is driver-specific).

But assuming that all implementations are using a map
for getting the column of a specific name, the performance-
difference shouldn't be that big.

But you're invited to do the test and tell us the results.

I would imagine the results of such a test to be highly sensitive to
optimization issues such as amount of available RAM, presence, number and
density of other activities in the JVM, GC algorithm in use, usage pattern of
the JDBC calls in the test, operating platform (OS and hardware) and so on.

I suspect that the only reliable conclusion in the face of JIT compilation and
its many varying optimization factors is "YMMV".
 
T

Tom Hawtin

Lew said:
I would imagine the results of such a test to be highly sensitive to
optimization issues such as amount of available RAM, presence, number
and density of other activities in the JVM, GC algorithm in use, usage
pattern of the JDBC calls in the test, operating platform (OS and
hardware) and so on.

What would you imagine the costs to be.

AFAICS, get(String) needs to look up the name in a map to find the index
number. Time for that? Bugger all (unless you have a JDBC driver that
phenomenally broken). Compare that to the time taken for a round trip to
the database or a disc access. Some things you should measure, some
thing are not worth it (unless your profiler zooms in on the problem).

Tom Hawtin
 
L

Lew

Tom said:
What would you imagine the costs to be.

AFAICS, get(String) needs to look up the name in a map to find the index
number. Time for that? Bugger all (unless you have a JDBC driver that
phenomenally broken). Compare that to the time taken for a round trip to
the database or a disc access. Some things you should measure, some
thing are not worth it (unless your profiler zooms in on the problem).

Yeah, you're right.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top