Re: COUNT & Pagination

From: Richard Huxton <dev(at)archonet(dot)com>
To: "david(at)shadovitz(dot)com" <david(at)shadovitz(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: COUNT & Pagination
Date: 2004-01-12 10:16:37
Message-ID: 200401121016.37918.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sunday 11 January 2004 18:10, David Shadovitz wrote:
> I understand that COUNT queries are expensive. So I'm looking for advice
> on displaying paginated query results.
>
> I display my query results like this:
>
> Displaying 1 to 50 of 2905.
> 1-50 | 51-100 | 101-150 | etc.
>
> I do this by executing two queries.

If you only need the count when you've got the results, most PG client
interfaces will tell you how many rows you've got. What language is your app
in?

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Andrew Rawnsley 2004-01-12 15:02:09 Re: annoying query/planner choice
Previous Message Tom Lane 2004-01-12 05:40:13 Re: annoying query/planner choice