Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-performance by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group