Re: Does Postgresql have a similar pseudo-column "ROWNUM" as

From: Alain <alainm(at)pobox(dot)com>
To: Sql-Postgre <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Does Postgresql have a similar pseudo-column "ROWNUM" as
Date: 2005-05-17 18:43:32
Message-ID: 428A3B54.4070902@pobox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php 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

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Mariusz Pękala 2005-05-17 19:17:37 Re: ERROR: unterminated quoted string... help
Previous Message Postgres Admin 2005-05-17 18:33:03 Re: [SQL] ERROR: unterminated quoted string... help

Browse pgsql-sql by date

  From Date Subject
Next Message Mariusz Pękala 2005-05-17 19:17:37 Re: ERROR: unterminated quoted string... help
Previous Message Postgres Admin 2005-05-17 18:33:03 Re: [SQL] ERROR: unterminated quoted string... help