From: Tom Lane <tgl@sss.pgh.pa.us>
To: l1t@tom.com
Cc: pgsql-bugs@postgresql.org
Cc: ringerc@ringerc.id.au
Subject: Re: RE:Re: BUG #7556 addition info
Date: Wed, 03 Oct 2012 13:58:59 -0400
Message-ID: <18047.1349287139@sss.pgh.pa.us> (raw)
In-Reply-To: <506B9573.000017.14453@cnapp22>
References: <506B9573.000017.14453@cnapp22>
l1t@tom.com writes:
> I think the id columns of table a and b are not null, so the query of "not in" and "not exists" are equal,they should use similar plans.
NOT IN and NOT EXISTS are *not* equivalent. Per SQL standard, NOT IN
has different (and usually not very desirable) behavior with NULL
values. The spec-mandated behavior makes it a lot harder to optimize
nicely --- and since you usually don't want what it does anyway, we
haven't tried hard.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, l1t@tom.com, ringerc@ringerc.id.au
Subject: Re: BUG #7556 addition info
In-Reply-To: <18047.1349287139@sss.pgh.pa.us>
References: <506B9573.000017.14453@cnapp22> <18047.1349287139@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox