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


From: David Wheeler <david(at)wheeler(dot)net>
To: sfpug(at)postgresql(dot)org
Subject: Offset
Date: 2003-08-27 14:08:00
Message-ID: (view raw, whole thread or download thread mbox)
Lists: sfpug
Hi All,

I've got a quick question about OFFSET. Bricolage has a paginated 
search interface. Currently, it retrieves and constructs all of the 
objects for a search from the database, but then only displays those 
for the current page. This is of course very inefficient, especially if 
there are 1000s of objects and you're displaying only 50/page.

What I'd like to do is change the queries to use ORDER, LIMIT, and 
OFFSET to limit the number of objects fetched from PostgreSQL to just 
those for the current page. However, the queries to grab the objects 
use joins, and thus there will usually be multiple rows for each object.

My question is this: Is there any way to use OFFSET or some other 
construct to limit the number of rows to the number of objects I'm 
fetching? There will always be an ID field to identify the objects as 



David Wheeler                                     AIM: dwTheory
david(at)kineticode(dot)com                              ICQ: 15726394                     Yahoo!: dew7e
                                                Jabber: Theory(at)jabber(dot)org
Kineticode. Setting knowledge in motion.[sm]


  • Re: Offset at 2003-08-28 04:52:29 from Stephan Szabo

sfpug by date

Next:From: Stephan SzaboDate: 2003-08-28 04:52:29
Subject: Re: Offset
Previous:From: postmasterDate: 2003-08-26 15:01:08

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