On Jun 14, 2006, at 16:34 UTC, Eduardo wrote:

> >I need to select a large set of records out of a table, sort them by 
> >one column, and then get just a subset of the sorted list.  (For 
> >example, I might want records 40-60 ordered by date, which is a 
> >completely different set than records 40-60 ordered by user ID.)  I 
> >start with the full list of record IDs I want, and a query something like 
> >this:
> 
> So you want the records from position 40 to position 60 ?

Yes, if by "position" you are referring to the sorted list.

> In DB2 was faster select the 0-59 (1 to 60) records from the date 
> ordered table and from that selection in inverse order, select the 
> 0-19 (1-20). It was faster because selecting records from 0 (1) to 
> N-1 (N) was a lot faster than using the select records M-1(M) to 
> N-1(N), even when used two times.

In my tests, selecting the 20 records I want is no problem (iterating 
througheven 13000 records once the SELECT returns is lickety-split).  It's 
mainly the sorting that was the problem.

(Though the SELECT itself takes several seconds, but I'm assuming that that's 
already as fast as it can get.)

Best,
- Joe

--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

Reply via email to