Hello all you Gurus.
I'm trying to find out how to fetch sequential blocks of data from a
table in a most efficient way.
Let's suppose the following:
I have a reasonably large table (say 1Milion records) containing part
information (parts of machinery (eg. the SPJ database from C.J. Date :P)
) placed in a DB2 database (stinger).
I have a client which uses a grid to browse through the data.
Let's say I want to use the grid to browse through all the parts stored
in that table (don't ask why I just wanna). Obviously I don't want to
send the entire table to the client, so I want to browse through the
data using blocks (lets say each of 100 records).
When I reach the end of one block the other block should be loaded and
displayed.
During the day data is stored in the database.
The primary key is a part number.
One way to do this is by selecting the first (blocknr * 100) rows,
reverse sort it and then select the first 100 rows of that resultset.
using this method on a rather large table can be painful, especially
when you get to the blocks near the end of the table.
I'm experimenting with a Multidimensional Table (MDC).
Using a special blocknumber column in the table I can fysically store
the parts in groups of 100 records, but during the administration window
the blocknumbers need to be redistributed (and REORG-ed) to keep the
blocksize near 100.
In short:
I just want to be able to browse through a table using blocks, but I
don't know how to do this in the most efficient way.
Does anyone have any opinion on this.
(BTW, it's not my idea to browse through a huge table, and I really
don't want to, but since it is not my descision to make.)
-R-