Re: COUNT & Pagination - Mailing list pgsql-performance

From Robert Treat
Subject Re: COUNT & Pagination
Date
Msg-id 1073943732.29178.153.camel@camel
Whole thread Raw
In response to Re: COUNT & Pagination  (David Shadovitz <david@shadovitz.com>)
List pgsql-performance
On Mon, 2004-01-12 at 10:37, David Shadovitz wrote:
> > 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?
>
> PHP.
> But I have only a subset of the results, retrieved via a query with a "LIMIT
> <m>" clause, so $pg_numrows is m.
> And retrieving all results (i.e. no LIMIT) is at least as expensive as
> COUNT(*).
>

Depending on frequency of updates and need for real time info, you could
cache the count in session as long as the user stays within the given
piece of your app.

Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL


pgsql-performance by date:

Previous
From: Greg Spiegelberg
Date:
Subject: Re: failures on machines using jfs
Next
From: "cnliou"
Date:
Subject: Ignore Some Updates