From: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com> |
---|---|
To: | "Robins Tharakan" <tharakan(at)gmail(dot)com> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: count * performance issue |
Date: | 2008-03-11 03:08:44 |
Message-ID: | 20080310200844.2281f0e8@jd-laptop |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Tue, 11 Mar 2008 08:27:05 +0530
"Robins Tharakan" <tharakan(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2008-03-11 03:11:27 | Re: count * performance issue |
Previous Message | Mark Mielke | 2008-03-11 03:01:51 | Re: count * performance issue |