You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Bill Robertson <bi...@tekbot.com> on 2007/07/06 14:17:49 UTC

What is the recommended way to page result sets?

First off, I would like to categorically state that Apache Derby is one 
of the most fantastic things to come down the pike in Java's history.  I 
make sure to push it whenever the opportunity presents itself. 

Thanks to everybody.

I am working on a not too complicated gui program with an embedded derby 
store.  If the program stays in service long enough, I can see some of 
the queries returning result sets on the order of several thousand rows. 

My initial idea is to use a scrollable result set, grab the first chunk, 
close the result set, display them, and if the user asks for more, 
repeat the query, advance n rows (ResultSet.relative()), and repeat.

If I do this, will Derby begin to fetch rows as soon as I execute the 
query, and I will therefore waste a lot of time?  Does skipping rows 
involve reading them all?  i.e. is that a linear operation?  Is there a 
better way to do this?

Thanks