Re: not in(subselect) in 8.4

Поиск
Список
Период
Сортировка
От Scott Carey
Тема Re: not in(subselect) in 8.4
Дата
Msg-id BDFBB77C9E07BE4A984DAAE981D19F961AE363D982@EXVMBX018-1.exch018.msoutlookonline.net
обсуждение исходный текст
Ответ на Re: not in(subselect) in 8.4  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: not in(subselect) in 8.4  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
Are there any optimizations planned for the case where columns are defined as NOT NULL?  Or other special path
filteringfor cases where the planner can know that the set of values in the subselect won't contain NULLs  (such as in
(selecta from b where (a > 0 and a < 10000). 

It turns out to be a rare use case for someone to write a subselect for a NOT IN  or IN clause that will have NULL
values. In the common case, the subselect does not contain nulls.  I would like to see Postgres optimize for the common
case.

________________________________________
From: pgsql-performance-owner@postgresql.org [pgsql-performance-owner@postgresql.org] On Behalf Of Tom Lane
[tgl@sss.pgh.pa.us]
Sent: Friday, February 20, 2009 7:33 AM
To: Grzegorz Jaśkiewicz
Cc: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] not in(subselect) in 8.4

=?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= <gryzman@gmail.com> writes:
> I mean query like:
> select id from foo where id not in ( select id from bar);
> into:
> select f.id from foo f left join bar b on f.id=b.id where b.id is null;

Postgres does not do that, because they don't mean the same thing ---
the behavior for NULLs in bar.id is different.

8.4 does understand that NOT EXISTS is an antijoin, though.

                        regards, tom lane

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: not in(subselect) in 8.4
Следующее
От: "Jonah H. Harris"
Дата:
Сообщение: Re: Benchmark comparing PostgreSQL, MySQL and Oracle