X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E7C4A52A78 for ; Fri, 8 Jul 2005 12:31:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18516-01 for ; Fri, 8 Jul 2005 15:31:04 +0000 (GMT) Received: from smtp102.rog.mail.re2.yahoo.com (smtp102.rog.mail.re2.yahoo.com [206.190.36.80]) by svr1.postgresql.org (Postfix) with SMTP id 15B9952A76 for ; Fri, 8 Jul 2005 12:31:02 -0300 (ADT) Received: (qmail 80797 invoked from network); 8 Jul 2005 15:31:02 -0000 Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp102.rog.mail.re2.yahoo.com with SMTP; 8 Jul 2005 15:31:02 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 067043F9E; Fri, 8 Jul 2005 11:31:01 -0400 (EDT) Date: Fri, 8 Jul 2005 11:31:00 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: Make COUNT(*) Faster? Message-ID: <20050708153100.GC21449@phlogiston.dyndns.org> References: <9EF2931D-1097-470D-8ECB-59D00166C96F@apple.com> <60vf3mklue.fsf@dba2.int.libertyrms.com> <42CE89CA.2070607@noao.edu> <20050708143508.GD22725@wolff.to> <42CE96AF.3020903@noao.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42CE96AF.3020903@noao.edu> User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.043 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200507/75 X-Sequence-Number: 22053 On Fri, Jul 08, 2005 at 08:07:27AM -0700, Steve Wampler wrote: > Bruno Wolff III wrote: > > No, it is an exact count. > > Yes, for the transaction, but it's an approximation of the number of > tuples in the table - which is probably what the people who worry about > its cost are more interested in (an approximate count for the table). You seem to have the wrong idea of "tuples in the table" here. You need to think harder about MVCC visibility rules. Given MVCC, there isn't really a "view from nowhere" in the system -- there's just the idea of what tuple visibility. For a little more, you might want to look at the presentation Tom Lane made for this: http://www.postgresql.org/files/developer/transactions.pdf A -- Andrew Sullivan | ajs@crankycanuck.ca A certain description of men are for getting out of debt, yet are against all taxes for raising money to pay it off. --Alexander Hamilton