my dog learned polymorphism*
The moose likes JDBC and the fly likes Performance Issues with next statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Performance Issues with next statement " Watch "Performance Issues with next statement " New topic
Author

Performance Issues with next statement

matt alberty
Greenhorn

Joined: May 27, 2005
Posts: 6
In my code I use a while loop and next method on my result set. However, in this case it is taking upwards of 2 seconds to execute the next statement. Any ideas? The result set is only 4 rows. Am I not understanding exactly what the next method on the resultSet object is doing. It seems as if from the performance this is actually where the databse is getting queried.
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
Depending on your driver and database and any use of Statement.setFetchSize(), your driver may or may not be going across the network to the database to retrieve additional rows. Again, depending on your driver and database, this might require re-execution of the query. However, on most modern databases with adequate hardware, even with a big fetch size, the worst-case time for an execution of next() ought to be well under a 10th of a second (and with a large fetch size, most execution of next() should be under 1 millesecond).
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Does your complaint apply only to the first call to "next()" or to all of them?
matt alberty
Greenhorn

Joined: May 27, 2005
Posts: 6
The first call. At this point it's looking like it is a database issue.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Performance Issues with next statement