X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 587EAD1DAF9 for ; Tue, 13 Jan 2004 17:54:48 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 97487-05 for ; Tue, 13 Jan 2004 13:54:18 -0400 (AST) Received: from www.smart-start-hosting.com (unknown [38.118.153.169]) by svr1.postgresql.org (Postfix) with ESMTP id 43787D1D89C for ; Tue, 13 Jan 2004 13:54:17 -0400 (AST) Received: from shadovitz.com (localhost [127.0.0.1]) by localhost (8.10.2/8.10.2) with ESMTP id i0DHjXR11849; Tue, 13 Jan 2004 09:45:33 -0800 From: "David Shadovitz" To: "pgsql-performance@postgresql.org" Cc: mallah@trade-india.com Subject: Re: COUNT & Pagination Date: Tue, 13 Jan 2004 10:45:33 -0700 Message-Id: <20040113174533.M77388@www.shadovitz.com> In-Reply-To: <1157.192.168.0.100.1074015097.squirrel@system67.trade-india-local.com> References: <01C3D82B.388A7FE0.david@shadovitz.com> <1157.192.168.0.100.1074015097.squirrel@system67.trade-india-local.com> X-Mailer: Open WebMail 1.81 20021203 X-OriginatingIP: 206.135.121.30 (david@shadovitz.com) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/135 X-Sequence-Number: 5310 > 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