Re: not in(subselect) in 8.4

From: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: not in(subselect) in 8.4
Date: 2009-02-20 15:39:56
Message-ID: 2f4958ff0902200739q2dca1ch4e6933a4f76914c2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Feb 20, 2009 at 3:33 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> =?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= <gryzman(at)gmail(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Sergio Lopez 2009-02-20 15:57:27 Re: Benchmark comparing PostgreSQL, MySQL and Oracle
Previous Message Tom Lane 2009-02-20 15:33:53 Re: not in(subselect) in 8.4