Re: How to hint 2 coulms IS NOT DISTINCT FROM each other

Поиск
Список
Период
Сортировка
От Kim Rose Carlsen
Тема Re: How to hint 2 coulms IS NOT DISTINCT FROM each other
Дата
Msg-id AM4PR0501MB26108E40FC2BA5B398558799C7AD0@AM4PR0501MB2610.eurprd05.prod.outlook.com
обсуждение исходный текст
Ответ на Re: How to hint 2 coulms IS NOT DISTINCT FROM each other  (John R Pierce <pierce@hogranch.com>)
Список pgsql-general
>>    JOIN a AS table_b
>>     ON table_a.id = table_b.id
>>     AND table_a.key = table_b.key

> Anyways, to use an index for that join, you'd need a composite index on id *AND* key, not two separate indexes.
Its not as much as for using the index, but to be able to push the where clause inside both JOINED tables. 

The = operator already does this. It gives the planner the option to join the table in using either id = id or key = key. It can deduce that if I have a WHERE condition with table_a.key = 'Something', then table_b.key must also be 'Something'. It can then decide to filter table_b on key. When using IS NOT DISTINCT FROM, the planner is not considering the same options. Now its like it doesn't know table_a.key is same the same as table_b.key.

I would somehow expect the IS NOT DISTINCT FROM operator to do the same. As it establish the same rules.. If a = 'test' and a IS NOT DISTINCT FROM b then b = 'test' also

-
Kim Carlsen

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

Предыдущее
От: Karl Czajkowski
Дата:
Сообщение: Re: parallel query and row-level security?
Следующее
От: Melvin Davidson
Дата:
Сообщение: Re: Remove Standby (SLAVE) from Primary (MASTER) - Postgres9.1