Re: selects with large offset really slow - Mailing list pgsql-general

From Jean-Luc Lachance
Subject Re: selects with large offset really slow
Date
Msg-id 3E4929BA.DEA46449@nsd.ca
Whole thread Raw
In response to Re: selects with large offset really slow  (John Smith <john_smith_45678@yahoo.com>)
List 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@nsd.ca> wrote:
>
>      Why don't you use a temp table with a serial field and use is instead of
>      offset?

pgsql-general by date:

Previous
From: Phil Howard
Date:
Subject: Re: starting out
Next
From: Tom Lane
Date:
Subject: Re: Is Hash Agg being used? 7.4 seems to handle this query worse than 7.3