Re: Cursors or Offset, Limit?

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Cursors or Offset, Limit?
Date: 2005-11-16 20:43:39
Message-ID: 20051116204339.GB23557@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Nov 15, 2005 at 01:44:32PM -0500, Jerry LeVan wrote:
>
> What are some of the tradeoffs between using a cursor and using the
> limit/offset method of selecting rows to display?

OFFSET actually has to scan all the preceding rows every time (plus
to get it consistently, you need to do an ORDER BY), so it's fast at
first but possibly painfully slow in the last rows (especially on a
large table).

A

--
Andrew Sullivan | ajs(at)crankycanuck(dot)ca
A certain description of men are for getting out of debt, yet are
against all taxes for raising money to pay it off.
--Alexander Hamilton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Browne 2005-11-16 20:50:37 Re: Rebranding PostgreSQL
Previous Message Guy Rouillier 2005-11-16 19:51:33 Re: PREPARE TRANSACTION and webapps