Portal question

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Portal question
Date: 2001-07-30 09:07:26
Message-ID: ECEHIKNFIMMECLEBJFIGGEGKCBAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

This is the situation: You are doing a big query, but you want the results
on the web page to be paginated. ie. The user can click page 1, 2, etc.

So, you need know how many rows total would be returned, but you also only
need a small fraction of them.

What is an efficient way of doing this?

It seems to me that using a CURSOR would be advantageous, however once a
CURSOR is opened, how do you get the full row count?

ie. Can you do this:?

1. Declare a cursor
2. Find the total number of rows returned
3. Fetch the subset of the rows that are required
4. Construct a pagination based on the info from 2 and 3.

If this can't be done - how do you do it? Is the only way to repeat the
whole query twice, the first time doing a count(*) instead of the select
variables?

Thanks,

Chris

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2001-07-30 13:18:07 Re: PostgreSQL7.1 on AIX5L is running with too poor ferformance
Previous Message mlw 2001-07-30 08:47:19 Re: From TODO, XML?