Re: Postgres NOT IN vs NOT EXISTS optimization

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Postgres NOT IN vs NOT EXISTS optimization
Дата
Msg-id 76344.1655222956@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Postgres NOT IN vs NOT EXISTS optimization  ("Dirschel, Steve" <steve.dirschel@thomsonreuters.com>)
Ответы Re: Postgres NOT IN vs NOT EXISTS optimization  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-general
"Dirschel, Steve" <steve.dirschel@thomsonreuters.com> writes:
> Is Postgres able to drive the query the same way with the NOT IN as the
> NOT EXISTS is doing or is that only available if the query has a NOT
> EXISTS?

NOT IN is not optimized very well in PG, because of the strange
semantics that the SQL spec demands when the sub-query produces any
null values.  There's been some interest in detecting cases where
we can prove that the subquery produces no nulls and then optimizing
it into NOT EXISTS, but it seems like a lot of work for not-great
return, so nothing's happened (yet).  Perhaps Oracle does something
like that already, or perhaps they're just ignoring the semantics
problem; they do not have a reputation for hewing closely to the
spec on behavior regarding nulls.

            regards, tom lane



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

Предыдущее
От: Jeremy Smith
Дата:
Сообщение: Re: Postgres NOT IN vs NOT EXISTS optimization
Следующее
От: Daniel Brinzila
Дата:
Сообщение: Recent 11.16 release change