Re: COUNT & Pagination - Mailing list pgsql-performance

From Richard Huxton
Subject Re: COUNT & Pagination
Date
Msg-id 200401121016.37918.dev@archonet.com
Whole thread Raw
In response to COUNT & Pagination  (David Shadovitz <david@shadovitz.com>)
List 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

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: annoying query/planner choice
Next
From: Andrew Rawnsley
Date:
Subject: Re: annoying query/planner choice