postgres/src
Tom Lane bd3daddaf2 Arrange to convert EXISTS subqueries that are equivalent to hashable IN
subqueries into the same thing you'd have gotten from IN (except always with
unknownEqFalse = true, so as to get the proper semantics for an EXISTS).
I believe this fixes the last case within CVS HEAD in which an EXISTS could
give worse performance than an equivalent IN subquery.

The tricky part of this is that if the upper query probes the EXISTS for only
a few rows, the hashing implementation can actually be worse than the default,
and therefore we need to make a cost-based decision about which way to use.
But at the time when the planner generates plans for subqueries, it doesn't
really know how many times the subquery will be executed.  The least invasive
solution seems to be to generate both plans and postpone the choice until
execution.  Therefore, in a query that has been optimized this way, EXPLAIN
will show two subplans for the EXISTS, of which only one will actually get
executed.

There is a lot more that could be done based on this infrastructure: in
particular it's interesting to consider switching to the hash plan if we start
out using the non-hashed plan but find a lot more upper rows going by than we
expected.  I have therefore left some minor inefficiencies in place, such as
initializing both subplans even though we will currently only use one.
2008-08-22 00:16:04 +00:00
..
backend Arrange to convert EXISTS subqueries that are equivalent to hashable IN 2008-08-22 00:16:04 +00:00
bin Fix pg_dump/pg_restore's ExecuteSqlCommand() to behave suitably if PQexec 2008-08-16 02:25:06 +00:00
include Arrange to convert EXISTS subqueries that are equivalent to hashable IN 2008-08-22 00:16:04 +00:00
interfaces Synced parser. 2008-08-20 14:09:16 +00:00
makefiles Implement a few changes to how shared libraries and dynamically loadable 2008-04-07 14:15:58 +00:00
pl Implement SQL-spec RETURNS TABLE syntax for functions. 2008-07-18 03:32:53 +00:00
port Use CRITICAL_SECTION instead of Mutexes for thread-locking in libpq on 2008-05-21 14:20:48 +00:00
template Use SYSV semaphores rather than POSIX on Darwin >= 6.0 (i.e., OS X 10.2 2007-09-26 00:32:46 +00:00
test Clean up the loose ends in selectivity estimation left by my patch for semi 2008-08-16 00:01:38 +00:00
timezone Fix identify_system_timezone() so that it tests the behavior of the system 2008-07-01 03:40:55 +00:00
tools Remove tools and documention for generating TODO.html. 2008-08-20 18:22:28 +00:00
tutorial Add $PostgreSQL$ markers to a lot of files that were missing them. 2008-05-17 01:28:26 +00:00
bcc32.mak Remove old-style win32 client-only visual c++ build infrastructure for everything except 2007-03-05 14:18:38 +00:00
DEVELOPERS
Makefile Catch all errors in for and while loops in makefiles. Don't ignore any 2008-03-18 16:24:50 +00:00
Makefile.global.in Upgrade to Autoconf 2.61: 2008-02-17 16:36:43 +00:00
Makefile.shlib On cygwin and win32, don't override the shlib name when building a module. 2008-04-08 09:50:29 +00:00
nls-global.mk Another fix for compiles on an empty 'po' directory. 2008-05-17 21:27:12 +00:00
win32.mak Update supported standalone VC++ version to 7.1+ only, and fix 2007-08-03 10:47:11 +00:00