postgresql/src/backend
Tom Lane 5b7b5518d0 Revise parameterized-path mechanism to fix assorted issues.
This patch adjusts the treatment of parameterized paths so that all paths
with the same parameterization (same set of required outer rels) for the
same relation will have the same rowcount estimate.  We cache the rowcount
estimates to ensure that property, and hopefully save a few cycles too.
Doing this makes it practical for add_path_precheck to operate without
a rowcount estimate: it need only assume that paths with different
parameterizations never dominate each other, which is close enough to
true anyway for coarse filtering, because normally a more-parameterized
path should yield fewer rows thanks to having more join clauses to apply.

In add_path, we do the full nine yards of comparing rowcount estimates
along with everything else, so that we can discard parameterized paths that
don't actually have an advantage.  This fixes some issues I'd found with
add_path rejecting parameterized paths on the grounds that they were more
expensive than not-parameterized ones, even though they yielded many fewer
rows and hence would be cheaper once subsequent joining was considered.

To make the same-rowcounts assumption valid, we have to require that any
parameterized path enforce *all* join clauses that could be obtained from
the particular set of outer rels, even if not all of them are useful for
indexing.  This is required at both base scans and joins.  It's a good
thing anyway since the net impact is that join quals are checked at the
lowest practical level in the join tree.  Hence, discard the original
rather ad-hoc mechanism for choosing parameterization joinquals, and build
a better one that has a more principled rule for when clauses can be moved.
The original rule was actually buggy anyway for lack of knowledge about
which relations are part of an outer join's outer side; getting this right
requires adding an outer_relids field to RestrictInfo.
2012-04-19 15:53:47 -04:00
..
access Tighten up error recovery for fast-path locking. 2012-04-18 11:17:30 -04:00
bootstrap Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
catalog Silently ignore any nonexistent schemas that are listed in search_path. 2012-04-11 12:02:50 -04:00
commands After PageSetAllVisible, use MarkBufferDirty. 2012-04-18 10:49:37 -04:00
executor New GUC, track_iotiming, to track I/O timings. 2012-03-27 14:55:02 -04:00
foreign Add GetForeignColumnOptions() to foreign.c, and add some documentation. 2012-03-07 18:20:58 -05:00
lib Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
libpq Clean up compiler warnings from unused variables with asserts disabled 2012-03-21 23:33:10 +02:00
main Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
nodes Revise parameterized-path mechanism to fix assorted issues. 2012-04-19 15:53:47 -04:00
optimizer Revise parameterized-path mechanism to fix assorted issues. 2012-04-19 15:53:47 -04:00
parser Add DROP INDEX CONCURRENTLY [IF EXISTS], uses ShareUpdateExclusiveLock 2012-04-06 10:21:40 +01:00
po Translation updates 2011-08-17 14:07:46 +03:00
port Unbreak Windows builds broken by pgpipe removal. 2012-03-29 04:11:57 -04:00
postmaster Do stack-depth checking in all postmaster children. 2012-04-08 19:07:55 +03:00
regex Merge dissect() into cdissect() to remove a pile of near-duplicate code. 2012-02-24 18:40:31 -05:00
replication Cast some printf arguments to avoid possibly-nonportable behavior. 2012-03-23 20:18:04 -04:00
rewrite Add some infrastructure for contrib/pg_stat_statements. 2012-03-27 15:17:40 -04:00
snowball Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
storage Finish rename of FastPathStrongLocks to FastPathStrongRelationLocks. 2012-04-18 11:29:34 -04:00
tcop Tighten up error recovery for fast-path locking. 2012-04-18 11:17:30 -04:00
tsearch Collect and use element-frequency statistics for arrays. 2012-03-03 20:20:57 -05:00
utils Remove bogus comment from HeapTupleSatisfiesNow. 2012-04-18 11:50:45 -04:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Call check_keywords.pl in maintainer-check 2012-02-27 13:53:12 +02:00
Makefile Fix incorrect make maintainer-clean rule. 2012-04-07 18:16:50 -04:00
nls.mk Sort file list when creating gettext-files 2011-12-27 20:20:56 +02:00