postgresql/src/backend
Tom Lane 1cb108efb0 Dig down into sub-selects to look for column statistics.
If a sub-select's output column is a simple Var, recursively look for
statistics applying to that Var, and use them if available.  The need for
this was foreseen ages ago, but we didn't have enough infrastructure to do
it with reasonable speed until just now.

We punt and stick with default estimates if the subquery uses set
operations, GROUP BY, or DISTINCT, since those operations would change the
underlying column statistics (particularly, the relative frequencies of
different values) beyond recognition.  This means that the types of
sub-selects for which this improvement applies are fairly limited, since
most subqueries satisfying those restrictions would have gotten flattened
into the parent query anyway.  But it does help for some cases, such as
subqueries with ORDER BY or LIMIT.
2011-09-04 15:13:46 -04:00
..
access Clean up the #include mess a little. 2011-09-04 01:13:16 -04:00
bootstrap Clean up the #include mess a little. 2011-09-04 01:13:16 -04:00
catalog Clean up the #include mess a little. 2011-09-04 01:13:16 -04:00
commands Clean up the #include mess a little. 2011-09-04 01:13:16 -04:00
executor Clean up the #include mess a little. 2011-09-04 01:13:16 -04:00
foreign Remove unnecessary #include references, per pgrminclude script. 2011-09-01 10:04:27 -04:00
lib Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
libpq Remove unnecessary #include references, per pgrminclude script. 2011-09-01 10:04:27 -04:00
main Pgindent run before 9.1 beta2. 2011-06-09 14:32:50 -04:00
nodes Can't print PlannerGlobal's subroots list in outfuncs. 2011-09-04 14:43:52 -04:00
optimizer Clean up the #include mess a little. 2011-09-04 01:13:16 -04:00
parser Clean up the #include mess a little. 2011-09-04 01:13:16 -04:00
po Translation updates 2011-08-17 14:07:46 +03:00
port Remove unnecessary #include references, per pgrminclude script. 2011-09-01 10:04:27 -04:00
postmaster Clean up the #include mess a little. 2011-09-04 01:13:16 -04:00
regex Add markers for skips. 2011-08-26 18:15:13 -04:00
replication Clean up the #include mess a little. 2011-09-04 01:13:16 -04:00
rewrite Rearrange planner to save the whole PlannerInfo (subroot) for a subquery. 2011-09-03 15:36:24 -04:00
snowball Remove unnecessary #include references, per pgrminclude script. 2011-09-01 10:04:27 -04:00
storage Clean up the #include mess a little. 2011-09-04 01:13:16 -04:00
tcop Remove unnecessary #include references, per pgrminclude script. 2011-09-01 10:04:27 -04:00
tsearch Remove unnecessary #include references, per pgrminclude script. 2011-09-01 10:04:27 -04:00
utils Dig down into sub-selects to look for column statistics. 2011-09-04 15:13:46 -04:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Workaround for recursive make breakage 2011-01-13 09:32:06 +02:00
Makefile Fix symlink for errcodes.h so it works in VPATH builds from tarballs. 2011-06-22 13:08:08 -04:00
nls.mk Add the possibility to pass --flag arguments to xgettext calls 2011-06-27 00:37:21 +03:00