Re: *very* inefficient choice made by the planner (regarding

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: SZUCS Gábor <surrano(at)mailbox(dot)hu>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: *very* inefficient choice made by the planner (regarding
Date: 2004-06-18 14:29:25
Message-ID: 20172.1087568965@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

=?iso-8859-1?Q?SZUCS_G=E1bor?= <surrano(at)mailbox(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2004-06-18 14:57:07 Re: Major differences between oracle and postgres performance - what can I do ?
Previous Message pginfo 2004-06-18 13:59:02 Re: Major differences between oracle and postgres performance