pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mark Kirkwood <markir@paradise.net.nz>
Cc: mark@mark.mielke.cc, Alessandro Baretta <a.baretta@barettadeit.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Suspending SELECTs
Date: Tue, 17 Jan 2006 23:02:21 -0500
Message-ID: <4245.1137556941@sss.pgh.pa.us> (raw)
In-Reply-To: <43CD8B45.4090907@paradise.net.nz>
References: <43CB71AC.20203@barettadeit.com>
	<9766.1137433907@sss.pgh.pa.us>
	<43CD4BD0.9090807@barettadeit.com>
	<20060117211259.GA13926@mark.mielke.cc>
	<43CD8B45.4090907@paradise.net.nz>

Mark Kirkwood <markir@paradise.net.nz> writes:
> SELECT ... FROM table WHERE ... ORDER BY id LIMIT 20;

> Suppose this displays records for id 10000 -> 10020.
> When the user hits next, and page saves id=10020 in the session state 
> and executes:

> SELECT ... FROM table WHERE ... AND id > 10020 ORDER BY id LIMIT 20;

> Clearly you have to be a little careful about whether to use '>' or '>=' 
> depending on whether 'id' is unique or not (to continue using '>' in the 
> non unique case, you can just save and use all the members of the 
> primary key too).

This is actually fairly painful to get right for a multi-column key
at the moment.  It'll be much easier once I finish up the
SQL-spec-row-comparison project.  See this thread for background:
http://archives.postgresql.org/pgsql-performance/2004-07/msg00188.php

			regards, tom lane



view thread (29+ messages)  latest in thread

Message-ID: <4245.1137556941@sss.pgh.pa.us>
Permalink:  ../4245.1137556941@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4245.1137556941@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, markir@paradise.net.nz, a.baretta@barettadeit.com
  Subject: Re: Suspending SELECTs
  In-Reply-To: <4245.1137556941@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox