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

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to