On Fri, Feb 20, 2009 at 3:33 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> =?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.
yes, the obvious assumption here is that all columns are 'not null';
> 8.4 does understand that NOT EXISTS is an antijoin, though.
Yes, I noticed that it actually assumes lesser cost.
--
GJ