Re: count * performance issue - Mailing list pgsql-performance

From Mark Mielke
Subject Re: count * performance issue
Date
Msg-id 47D5F61F.4080305@mark.mielke.cc
Whole thread Raw
In response to Re: count * performance issue  ("Robins Tharakan" <tharakan@gmail.com>)
List pgsql-performance
Robins Tharakan wrote:
Hi,

I have been reading this conversation for a few days now and I just wanted to ask this. From the release notes, one of the new additions in 8.3 is (Allow col IS NULL to use an index (Teodor)).

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 PostgreSQL: You still don't know whether the row is visible until you check the row. That it's NULL or NOT NULL does not influence this truth.

Cheers,
mark

-- 
Mark Mielke <mark@mielke.cc>

pgsql-performance by date:

Previous
From: "Robins Tharakan"
Date:
Subject: Re: count * performance issue
Next
From: "Joshua D. Drake"
Date:
Subject: Re: count * performance issue