> 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

Signature
Lothar Kimmeringer E-Mail: spamfang@kimmeringer.de
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)
Always remember: The answer is forty-two, there can only be wrong
questions!
Lew - 20 May 2007 23:59 GMT
>> 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
[quoted text clipped - 13 lines]
>
> 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".

Signature
Lew
Tom Hawtin - 21 May 2007 00:46 GMT
> 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
Lew - 21 May 2007 02:54 GMT
>> I would imagine the results of such a test to be highly sensitive to
>> optimization issues such as amount of available RAM, presence, number
[quoted text clipped - 9 lines]
> 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.

Signature
Lew