Offset

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: DDD3042A-D897-11D7-9FE7-0003931A964A@wheeler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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
objects.

TIA,

David

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

Responses

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

Browse sfpug by date

  From Date Subject
Next Message Stephan Szabo 2003-08-28 04:52:29 Re: Offset
Previous Message postmaster 2003-08-26 15:01:08 VIRUS DANS VOTRE MAIL