Re: Does Postgresql have a similar pseudo-column "ROWNUM" as - Mailing list pgsql-sql

From Alain
Subject Re: Does Postgresql have a similar pseudo-column "ROWNUM" as
Date
Msg-id 428A3B54.4070902@pobox.com
Whole thread Raw
In response to Re: Does Postgresql have a similar pseudo-column "ROWNUM" as  (Ragnar Hafstað <gnari@simnet.is>)
Responses Re: Does Postgresql have a similar pseudo-column "ROWNUM" as
Re: Does Postgresql have a similar pseudo-column "ROWNUM" as
List pgsql-sql
>>>
>>>No.  What is the purpose of your query?  You could use ORDER BY and
>>>LIMIT..OFFSET to do what you want. I think.
>>
>>The problem is probably speed. I have done a lot of tests, and when 
>>OFFSET gets to a few thousands on a multimega-recs database, it gets 
>>very very slow... 
> 
> 
> is there not a similar loss of speed using ROWNUM on oracle?
> 
> 
>>... Is there any other to work around that?
> 
> 
> if you are ordering by a unique key, you can use the key value
> in a WHERE clause.
> 
> select ... where ukey>? order by ukey limit 100 offset 100;
> 
> (the ? is placeholder for the last value of ukey returned
> from previous select)

I tried that. It does not work in the generic case: 6 MegaRec, telephone 
listing, alphabetical order. The problem is that somewhere there is a 
single user with too many entries (over 1000). I even tried to filter 
the repetitions, but somewhere I get stuck if one guy has too mny 
entries (one for each phone number).

I tried using both the name and the primary key (with a combined index), 
to get faster to the record I want, but I was not sucessfull in building 
a where clause.

I would appreciate any help, in fact this is my primary reason for 
joining this list ;-)

Alain


pgsql-sql by date:

Previous
From: Postgres Admin
Date:
Subject: Re: ERROR: unterminated quoted string... help
Next
From: Andrew Sullivan
Date:
Subject: Re: Does Postgresql have a similar pseudo-column "ROWNUM" as