Re: selects with large offset really slow

From: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
To: John Smith <john_smith_45678(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: selects with large offset really slow
Date: 2003-02-11 16:50:02
Message-ID: 3E4929BA.DEA46449@nsd.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

John,

CREATE TEMP TABLE results (
ndx SERIAL,
{ plus all the fields you get from your query}
);

INSERT INTO results( {all your fields except ndx})
SELECT ...
;

then

select ... from results where dnx >= start limit 100;

JLL

John Smith wrote:

> how?
>
> Jean-Luc Lachance <jllachan(at)nsd(dot)ca> wrote:
>
> Why don't you use a temp table with a serial field and use is instead of
> offset?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-02-11 16:53:24 Re: Is Hash Agg being used? 7.4 seems to handle this query worse than 7.3
Previous Message Phil Howard 2003-02-11 16:48:14 Re: starting out