Skip site navigation (1) Skip section navigation (2)

Re: [SQL] OFFSET impact on Performance???

From: Richard Huxton <dev(at)archonet(dot)com>
To: Andrei Bintintan <klodoma(at)ar-sd(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: Re: [SQL] OFFSET impact on Performance???
Date: 2005-01-20 15:20:59
Message-ID: 41EFCC5B.5010302@archonet.com (view raw or flat)
Thread:
Lists: pgsql-performancepgsql-sql
Andrei Bintintan wrote:
>> If you're using this to provide "pages" of results, could you use a 
>> cursor?
> 
> What do you mean by that? Cursor?
> 
> Yes I'm using this to provide "pages", but If I jump to the last pages 
> it goes very slow.

DECLARE mycursor CURSOR FOR SELECT * FROM ...
FETCH FORWARD 10 IN mycursor;
CLOSE mycursor;

Repeated FETCHes would let you step through your results. That won't 
work if you have a web-app making repeated connections.

If you've got a web-application then you'll probably want to insert the 
results into a cache table for later use.

--
   Richard Huxton
   Archonet Ltd

In response to

Responses

pgsql-performance by date

Next:From: Hervé PiedvacheDate: 2005-01-20 15:23:17
Subject: Re: PostgreSQL clustering VS MySQL clustering
Previous:From: Merlin MoncureDate: 2005-01-20 15:16:21
Subject: Re: PostgreSQL clustering VS MySQL clustering

pgsql-sql by date

Next:From: Michael FuhrDate: 2005-01-20 16:32:30
Subject: Re: ERROR: row is too big: size 9856, maximum size 8136
Previous:From: Achilleus MantziosDate: 2005-01-20 15:08:53
Subject: Re: pg_user relationship does not exist

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group