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

From Joshua D. Drake
Subject Re: count * performance issue
Date
Msg-id 20080310200844.2281f0e8@jd-laptop
Whole thread Raw
In response to Re: count * performance issue  ("Robins Tharakan" <tharakan@gmail.com>)
List pgsql-performance
On Tue, 11 Mar 2008 08:27:05 +0530
"Robins Tharakan" <tharakan@gmail.com> wrote:

> SELECT COUNT(*) from table WHERE indexed_field IS NULL
> +
> SELECT COUNT(*) from table WHERE indexed_field IS NOT NULL

If the selectivity is appropriate yes. However if you have 1 million
rows, and 200k of those rows are null (or not null), it is still going
to seqscan.

joshua d. drake

--
The PostgreSQL Company since 1997: http://www.commandprompt.com/
PostgreSQL Community Conference: http://www.postgresqlconference.org/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL SPI Liaison | SPI Director |  PostgreSQL political pundit


Attachment

pgsql-performance by date:

Previous
From: Mark Mielke
Date:
Subject: Re: count * performance issue
Next
From: "Scott Marlowe"
Date:
Subject: Re: count * performance issue