• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Performance Issues with next statement

 
matt alberty
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your complaint apply only to the first call to "next()" or to all of them?
 
matt alberty
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first call. At this point it's looking like it is a database issue.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic