From: | "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Martijn van Oosterhout" <kleptog(at)svana(dot)org> |
Cc: | <pgsql-hackers(at)postgresql(dot)org>,<pgsql-performance(at)postgresql(dot)org>, "Andrea Olson" <Aolson(dot)CCAP(dot)Courts(at)wicourts(dot)gov>, "Bill Severson" <BSEVERS(dot)CCAP(dot)Courts(at)wicourts(dot)gov>, "John Hutchins" <jhutchi(dot)CCAP(dot)Courts(at)wicourts(dot)gov>, "Randy Peterson" <RPETERS(dot)CCAP(dot)Courts(at)wicourts(dot)gov>, "Shannon Spranger" <ssprang(dot)CCAP(dot)Courts(at)wicourts(dot)gov> |
Subject: | Re: EXISTS optimization |
Date: | 2007-03-23 22:30:27 |
Message-ID: | 46040EB2.EE98.0025.0@wicourts.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-performance |
I don't understand -- TRUE OR UNKNOWN evaluates to TRUE, so why would the IN need to continue? I'm not quite following the rest; could you elaborate or give an example? (Sorry if I'm lagging behind the rest of the class here.)
-Kevin
>>> Martijn van Oosterhout <kleptog(at)svana(dot)org> 03/23/07 5:26 PM >>>
On Fri, Mar 23, 2007 at 05:49:42PM -0400, Tom Lane wrote:
> We don't currently try to flatten EXISTS into a unique/join plan as we
> do for IN. I seem to recall not doing so when I rewrote IN planning
> because I didn't think it would be exactly semantically equivalent,
> but that was awhile ago. Right at the moment it seems like it ought
> to be equivalent as long as the comparison operators are strict.
Wasn't it due to the fact that IN needs to scan through all
possibilites anyway because of its interaction with NULL, whereas
EXISTS can stop at the first row?
That would mean the subquery to be materialised would not be equivalent
if it called any non-immutable functions. It's also much less clear to
be a win in the EXISTs case. But then, that's a costs issue the planner
can deal with...
Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2007-03-23 22:37:16 | Re: [PERFORM] EXISTS optimization |
Previous Message | Martijn van Oosterhout | 2007-03-23 22:26:41 | Re: EXISTS optimization |
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2007-03-23 22:37:16 | Re: [PERFORM] EXISTS optimization |
Previous Message | Martijn van Oosterhout | 2007-03-23 22:26:41 | Re: EXISTS optimization |