Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using a scrollable resultset to retrieve 'rowcount'

 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

So let's assume that there are 10 000 rows returned, and the fetch size on the resultset is 100. And I suspect this is up to the driver... but when I do the call at //1, is it going to 'fetch' 100 blocks of 100 rows each ? Will it really marshal all that data over the pipe ? I think the answer must be "only if your driver implementer was smoking crack". It must somhow short-circuit the process, most likely using low-level database cursors. Else, how would
rs.absolute(5)
or
rs.absolute(-3) work ?

I'm just wondering if anyone has played with this at all? Does the //1 //2 //3 step really kill the db ? I'd try it myself, but I uh... don't have that many rows.
 
Philip Shanks
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have done this with tables in a SQL Server 2000 RDBMS, using the MS JDBC driver. While I don't have ResultSet's with 10k rows, I do sometimes see >3000, and have seen no obvious ill effects.
My web app is not a very high traffic one though, as it was built to provide reporting capabilities to perhaps only a dozen or so users. The response time is pretty snappy nevertheless. Even when there are on the order of 3000-4000 rows (I only display 20 at a time), the response times are very similar to those for static content.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic