Re: count * performance issue

Поиск
Список
Период
Сортировка
От Joshua D. Drake
Тема Re: count * performance issue
Дата
Msg-id 20080310200844.2281f0e8@jd-laptop
обсуждение исходный текст
Ответ на Re: count * performance issue  ("Robins Tharakan" <tharakan@gmail.com>)
Список 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


Вложения

В списке pgsql-performance по дате отправления:

Предыдущее
От: Mark Mielke
Дата:
Сообщение: Re: count * performance issue
Следующее
От: "Scott Marlowe"
Дата:
Сообщение: Re: count * performance issue