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 81DA5D1B432 for ; Mon, 12 Jan 2004 10:17:13 +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 28168-02 for ; Mon, 12 Jan 2004 06:16:44 -0400 (AST) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP id B52ADD1DA6C for ; Mon, 12 Jan 2004 06:16:41 -0400 (AST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-31.mail.demon.net with esmtp (Exim 3.35 #1) id 1Afz7g-0002gY-0V; Mon, 12 Jan 2004 10:16:41 +0000 Received: by mainbox.archonet.com (Postfix, from userid 529) id C08A016E2D; Mon, 12 Jan 2004 10:16:39 +0000 (GMT) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 4A98816DC9; Mon, 12 Jan 2004 10:16:38 +0000 (GMT) From: Richard Huxton To: "david@shadovitz.com" , "pgsql-performance@postgresql.org" Subject: Re: COUNT & Pagination Date: Mon, 12 Jan 2004 10:16:37 +0000 User-Agent: KMail/1.5 References: <01C3D82B.388A7FE0.david@shadovitz.com> In-Reply-To: <01C3D82B.388A7FE0.david@shadovitz.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200401121016.37918.dev@archonet.com> X-Bogosity: No, tests=bogofilter, spamicity=0.000000, version=0.15.3 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/121 X-Sequence-Number: 5296 On Sunday 11 January 2004 18:10, David Shadovitz wrote: > I understand that COUNT queries are expensive. So I'm looking for advice > on displaying paginated query results. > > I display my query results like this: > > Displaying 1 to 50 of 2905. > 1-50 | 51-100 | 101-150 | etc. > > I do this by executing two queries. 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? -- Richard Huxton Archonet Ltd