RE: sql question
Posted in 1995
Herve writes
> How can we made a sql request on a huge table that will get out
>the last lines without using the rowid column?
>ex.: let's say that count(*) return 10000 on this table. If we want to get
> the last fifty lines, for now we are doing:
> select col1, col2 from table
> where rowid > 9950
> Any help will be appreciate!
My only suggestion is to unload the table including the rowid
and make a copy of the current table definition before dropping it.
Before reloading, add a serial column to the table. This serial column
is going to be used to store the unloaded rowids.
Reload the table and use the serial key.
This will of course rely on the fact that you do not delete from the table
and you will [possibly] need to change all your inserts!
Mark Denham
BBC
London, UK
Mark.Denham@bbc.co.uk