Re: COUNT & Pagination

From: "David Shadovitz" <david(at)www(dot)shadovitz(dot)com>
To: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Cc: mallah(at)trade-india(dot)com
Subject: Re: COUNT & Pagination
Date: 2004-01-13 17:45:33
Message-ID: 20040113174533.M77388@www.shadovitz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> We avert the subsequent execution of count(*) by passing the
> value of count(*) as a query parameter through the link in page
> numbers.

Mallah, and others who mentioned caching the record count:

Yes, I will certainly do this. I can detect whether the query's filter has
been changed, or whether the user is merely paging through the results or
sorting* the results.

I'd love to completely eliminate the cost of the COUNT(*) query, but I guess
that I cannot have everything.

* My HTML table column headers are hyperlinks which re-execute the query,
sorting the results by the selected column. The first click does an ASC
sort; a second click does a DESC sort.

Thanks.
-David

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message scott.marlowe 2004-01-13 17:55:59 Re: COUNT & Pagination
Previous Message mallah 2004-01-13 17:31:37 Re: COUNT & Pagination