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"
<williamevanw@...>
wrote:
> 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
displayed
> to a user and sometimes take quite some time to load.
>
> Is there a way to progressively load the resultset into the jtable? Do
it
> in sections so that the user sees the records are being loaded instead
of
> 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
statement.
http://www.firebirdsql.org/refdocs/langrefupd25-select.html#langrefupd25-select-rows

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.

Mark