Subject Re: [firebird-support] Return SQL result in portions / progressively load result set
Author Mark Rotteveel
On Fri, 31 Aug 2012 08:23:17 -0000, "williamevanw"
> Hi guys,
> I have several database tables that can grow to contain more than a
> million records. These tables are loaded into a jTable and then
> to a user and sometimes take quite some time to load.
> Is there a way to progressively load the resultset into the jtable? Do
> in sections so that the user sees the records are being loaded instead
> waiting?
> I would imagine that this can be accomplished either by SQL or by an
> unknown feature or setting in the database..
> I don't know where to start looking..
> Any advice or guidance greatly appreciated..

You should query what you need using the ROWS clause in your select

It has been a while since I used JTable, but I seem to recall that you
should be able to define events when it needs more rows and then query
those rows to update your TableModel. One thing you should take into
account however is that it is unwise (performance wise) to try to query the
total amount of rows beforehand (eg using SELECT COUNT(*)), as that is an
inefficient operation in Firebird.

Ideally you would want to use scrollable ResultSets for this, but that
will actually result in Jaybird loading all rows anyway.