Re: missing optimization - column <> column

Поиск
Список
Период
Сортировка
От Pantelis Theodosiou
Тема Re: missing optimization - column <> column
Дата
Msg-id CAE3TBxyot9f1yEhmEaTpxN4+9rTBgRR_uX3cqcWegLNEFdvKaQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: missing optimization - column <> column  (Corey Huinker <corey.huinker@gmail.com>)
Список pgsql-hackers


On Mon, Dec 5, 2016 at 7:02 PM, Corey Huinker <corey.huinker@gmail.com> wrote:

Would it be worth replacing the condition with the equivalent?
I mean would that help optimizing better some queries when it knows that a is (not) nullable or when "a" is more complicated expression?

a <> a    :   (a IS NULL) AND NULL
a = a     :   (a IS NOT NULL) OR NULL


I think you're looking for

a IS DISTINCT FROM a 

And that will work for cases where a might be null.

I have no opinion about whether adding such a test to the planner is worth it.

No,  (a IS DISTINCT FROM a) will evaluate to FALSE when a is NULL. The other conditions (a <> a) , ((a IS NULL) AND NULL) will evaluate to NULL.

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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Typmod associated with multi-row VALUES constructs
Следующее
От: Serge Rielau
Дата:
Сообщение: Re: missing optimization - column <> column