Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id CC9BC2E2F2B for ; Tue, 11 Mar 2008 11:02:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 06465-05-6 for ; Tue, 11 Mar 2008 11:01:54 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from service-web.de (p15093784.pureserver.info [217.160.106.224]) by postgresql.org (Postfix) with ESMTP id C5FE92E2FE5 for ; Tue, 11 Mar 2008 11:01:14 -0300 (ADT) Received: from [10.30.255.53] (unknown [83.100.136.234]) by service-web.de (Postfix) with ESMTP id DA8F0E82F2; Tue, 11 Mar 2008 15:01:10 +0100 (CET) Message-ID: <47D690A2.2090509@wildenhain.de> Date: Tue, 11 Mar 2008 15:01:06 +0100 From: Tino Wildenhain User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Matthew Cc: pgsql-performance@postgresql.org Subject: Re: count * performance issue References: <47D00DB2.7040007@emolecules.com> <18451.1204824562@sss.pgh.pa.us> <200803071727.36146.josh@agliodbs.com> <13345.1204940295@sss.pgh.pa.us> <87r6eia9tz.fsf@oxford.xeocode.com> <12ba3bf00803101354w15b023e1o237f564a1b01105f@mail.gmail.com> <36af4bed0803101957u6078127fq78dc3384fe78de5d@mail.gmail.com> <20080311093537.a60e2e3d.wmoran@collaborativefusion.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200803/231 X-Sequence-Number: 29185 Hi, Matthew wrote: > On Tue, 11 Mar 2008, Bill Moran wrote: > >> In response to "Robins Tharakan" : >>> Sorry, if I am missing something here, but shouldn't something like this >>> allow us to get a (fast) accurate count ? >>> >>> SELECT COUNT(*) from table WHERE indexed_field IS NULL >>> + >>> SELECT COUNT(*) from table WHERE indexed_field IS NOT NULL >> >> For certain, qualified definitions of "fast", sure. > > And certain, qualified definitions of "accurate" as well. Race condition? You mean in a three-state-logic? null, not null and something different? ;-) Tino