Re: BUG #7509: x NOT IN (select x from z) extremely slow in compare to select x from y except select x from z;

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #7509: x NOT IN (select x from z) extremely slow in compare to select x from y except select x from z;
Дата
Msg-id 10470.1346253644@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #7509: x NOT IN (select x from z) extremely slow in compare to select x from y except select x from z;  (stefan@konink.de)
Список pgsql-bugs
stefan@konink.de writes:
> The following is relatively fast:
> bag-2012-aug=# explain select count(*) from (select kvk from kvk_normal
> except select kvk from bag_kvk) as x;

> The 'normal' case basically doesn't finish:
> bag-2012-aug=# explain select count(*) from (select kvk_normal.kvk from
> kvk_normal where kvk_normal.kvk not in (select bag_kvk.kvk from bag_kvk)) as
> x;

NOT IN is difficult to optimize, as well as hard to use, because of its
rather bizarre behavior for nulls.  You might consider using NOT EXISTS
instead.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: hot standby lagging vs warm that is up-to-date
Следующее
От: Stuart Bishop
Дата:
Сообщение: Re: BUG #7500: hot-standby replica crash after an initial rsync