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

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: partial index on boolean, problem with v8.0.0rc1
Дата
Msg-id 20041213185905.GA11248@wolff.to
обсуждение исходный текст
Ответ на partial index on boolean, problem with v8.0.0rc1  (Igor Shevchenko <igor@carcass.ath.cx>)
Список pgsql-general
On Mon, Dec 13, 2004 at 20:18:57 +0200,
  Igor Shevchenko <igor@carcass.ath.cx> wrote:
>
> 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:
>
> 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;
>
> In the 1st case, partial index was used for the first query.

Note that whatever = TRUE is not equivalent to whatever IS TRUE.
The latter will return FALSE if whatever is NULL, while the former will return
NULL in that case.

There are also some limitations on the optimizer recognizing equivalent
varients of an expression. This might cause a problem with the third
select example.

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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Substring question
Следующее
От: Tom Lane
Дата:
Сообщение: Re: partial index on boolean, problem with v8.0.0rc1