Re: COUNT & Pagination

Поиск
Список
Период
Сортировка
От Robert Treat
Тема Re: COUNT & Pagination
Дата
Msg-id 1073943732.29178.153.camel@camel
обсуждение исходный текст
Ответ на Re: COUNT & Pagination  (David Shadovitz <david@shadovitz.com>)
Список 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 по дате отправления:

Предыдущее
От: Greg Spiegelberg
Дата:
Сообщение: Re: failures on machines using jfs
Следующее
От: "cnliou"
Дата:
Сообщение: Ignore Some Updates