Re: partial index on boolean, problem with v8.0.0rc1

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: partial index on boolean, problem with v8.0.0rc1
Дата
Msg-id 26878.1102963573@sss.pgh.pa.us
обсуждение исходный текст
Ответ на partial index on boolean, problem with v8.0.0rc1  (Igor Shevchenko <igor@carcass.ath.cx>)
Список pgsql-general
Igor Shevchenko <igor@carcass.ath.cx> writes:
> In both cases, tables are filled with ~10m of rows, "is_read" is false in the
> 1st case, and "NULL" in the 2nd. I did "VACUUM FULL ANALYSE" after both
> imports.

> Here's the problem: in the 2nd case, planner wouldn't choose an index scan
> using partial index on "is_read" for the following queries:

This is the same problem noted by Mike Mascari a couple weeks ago:
ANALYZE does not store any statistics about an all-null column.
So there are no stats and the default decision is not to risk an
indexscan

> explain select * from user_msg where is_read=true;
> explain select * from user_msg where is_read is true;
> explain select * from user_msg where is_read;

Only the first of these could possibly match the partial index anyway.
In theory the planner could recognize that the first and third are
equivalent spellings of the same condition, but it does not presently
do so.

            regards, tom lane

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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: partial index on boolean, problem with v8.0.0rc1
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: table with sort_key without gaps