Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Tim B - 20 May 2007 22:42 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
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
Lothar Kimmeringer - 20 May 2007 23:18 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
> 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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.