in reply to Browsing a sql table on the web
As TedPride wrote, the usage of LIMIT and/or OFFSET in sql query can help. My experience is that the real implementation very depends on GUI abilities, so I would like to roughly explain my requirement and implementation.
Req:
The user can navigate through very large table. He must be able to move to the first and last (!!!) page, he must know index of current page and he must be able to jump forward and backward not only one page, but also 5, 10, 50, 100, ... pages (to be able to "divide and conquer" when finding something by eyes).
Impl:
The challenge is related with db->program data flow. In PostgreSQL 7.x, which we used via DBI, we are able to use LIMIT and OFFSET, but we are not able to get the total count of rows when LIMIT is used. So I decided to not use LIMIT and let the sql machine construct the all rows (from OFFSET to the end). Hopefully, in that combination of PostgreSQL+DBI I am able to run that query, fetch only 100 rows in one command and get information about total rowcount of this query.
So my html form posts desired index of page (for instance 47th of 112) and my perl subroutine counts proper OFFSET, runs the query, fetches only 100 rows, create some array like (0, 36, 41, 46, 51, 56, 96, 111) which is in HTML interpreted as ('first', -10, -5, 'current', +5, +10, +50, 'last')
A little bit tricky, but it works.