Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 594F19FB539 for ; Thu, 22 Mar 2007 11:18:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 01308-05 for ; Thu, 22 Mar 2007 11:18:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by postgresql.org (Postfix) with ESMTP id 0B6C79FB611 for ; Thu, 22 Mar 2007 11:18:22 -0300 (ADT) Received: from osgiliath.mathom.us ([72.66.31.15]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JFB00HH66EH1GS4@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Thu, 22 Mar 2007 09:18:17 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id DCF22707E0 for ; Thu, 22 Mar 2007 10:18:11 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, port 10024) with LMTP id fJ2MJocKFZH0 for ; Thu, 22 Mar 2007 10:18:10 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 8AD3571224; Thu, 22 Mar 2007 10:18:10 -0400 (EDT) Date: Thu, 22 Mar 2007 10:18:10 -0400 From: Michael Stone Subject: Re: Performance of count(*) In-reply-to: To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20070322141807.GE11402@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Virus-Scanned: Debian amavisd-new at mathom.us X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 References: <200703221208.19358.albert@sedifa.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/319 X-Sequence-Number: 23724 On Thu, Mar 22, 2007 at 01:30:35PM +0200, ismo.tuononen@solenovo.fi wrote: >approximated count????? > >why? who would need it? where you can use it? Do a google query. Look at the top of the page, where it says "results N to M of about O". For user interfaces (which is where a lot of this count(*) stuff comes from) you quite likely don't care about the exact count, because the user doesn't really care about the exact count. IIRC, that's basically what you get with the mysql count anyway, since there are corner cases for results in a transaction. Avoiding those cases is why the postgres count takes so long; sometimes that's what's desired and sometimes it is not. Mike Stone