From: Tom Lane <tgl@sss.pgh.pa.us>
To: SZUCS Gábor <surrano@mailbox.hu>
Cc: pgsql-performance@postgresql.org
Subject: Re: *very* inefficient choice made by the planner (regarding
Date: Fri, 18 Jun 2004 10:29:25 -0400
Message-ID: <20172.1087568965@sss.pgh.pa.us> (raw)
In-Reply-To: <008501c4550f$87523a80$0403a8c0@fejleszt4>
References: <200406101624.21739.ftm.van.vugt@foxi.nl>
<40C881FE.5000301@sympatico.ca>
<25304.1086883145@sss.pgh.pa.us>
<40C892BA.8080704@sympatico.ca>
<20040610100332.D20710@megazone.bigpanda.com>
<20040610101410.X21002@megazone.bigpanda.com>
<008501c4550f$87523a80$0403a8c0@fejleszt4>
=?iso-8859-1?Q?SZUCS_G=E1bor?= <surrano@mailbox.hu> writes:
>> It's NULLs inside the subselect that are the issue.
>
> select 1 in (select a from foo)
> select exists ( select 1 from foo where a=1)
> Just a dumb try :)
> SELECT (exists(select 1 from foo where a isnull) AND NULL)
> OR exists(select 1 from foo where a=1)
The more general case is where you have a variable (or expression)
on the left of IN. That could be NULL too, and this still doesn't
give the right result in that case :-(. With NULL on the left the
correct answer would be FALSE if the subselect has zero rows,
NULL otherwise.
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, surrano@mailbox.hu
Subject: Re: *very* inefficient choice made by the planner (regarding
In-Reply-To: <20172.1087568965@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