X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6A8979DC99D for ; Wed, 22 Feb 2006 13:42:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49435-10 for ; Wed, 22 Feb 2006 13:42:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A5A109DC877 for ; Wed, 22 Feb 2006 13:42:03 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k1MHg3qg013378; Wed, 22 Feb 2006 12:42:03 -0500 (EST) To: "Kevin Grittner" cc: pgsql-performance@postgresql.org Subject: Re: Good News re count(*) in 8.1 In-reply-to: <43FC4384.EE98.0025.0@wicourts.gov> References: <43FC4384.EE98.0025.0@wicourts.gov> Comments: In-reply-to "Kevin Grittner" message dated "Wed, 22 Feb 2006 10:57:08 -0600" Date: Wed, 22 Feb 2006 12:42:02 -0500 Message-ID: <13377.1140630122@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.111 required=5 tests=[AWL=0.111] X-Spam-Score: 0.111 X-Spam-Level: X-Archive-Number: 200602/348 X-Sequence-Number: 17334 "Kevin Grittner" writes: > We are replicating data from 72 source databases, each with the > official copy of a subset of the data, to four identical consolidated > databases, spread to separate locations, to serve our web site and other > organization-wide needs. Currently, two of these central databases are > running a commercial product and two are running PostgreSQL. There have > been several times that I have run a SELECT COUNT(*) on an entire table > on all central machines. On identical hardware, with identical data, > and equivalent query loads, the PostgreSQL databases have responded with > a count in 50% to 70% of the time of the commercial product, in spite of > the fact that the commercial product does a scan of a non-clustered > index while PostgreSQL scans the data pages. Interesting. I think though that the people who are complaining come from databases where COUNT(*) takes constant time because the DB keeps a running count in the table's metadata. regards, tom lane