diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-24 03:58:44 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-24 03:58:44 +0000 |
commit | f5e83662d06a40f90ceb3516fc88674eb6c1e4f9 (patch) | |
tree | 5b682c9bcbc9dd88b7bcc19f1ca1bf43c8335a83 /src/backend/optimizer/path/indxpath.c | |
parent | ef7422510e93266e5aa9bb926d6747d5f2ae21f4 (diff) | |
download | postgresql-f5e83662d06a40f90ceb3516fc88674eb6c1e4f9.tar.gz postgresql-f5e83662d06a40f90ceb3516fc88674eb6c1e4f9.zip |
Modify planner's implied-equality-deduction code so that when a set
of known-equal expressions includes any constant expressions (including
Params from outer queries), we actively suppress any 'var = var'
clauses that are or could be deduced from the set, generating only the
deducible 'var = const' clauses instead. The idea here is to push down
the restrictions implied by the equality set to base relations whenever
possible. Once we have applied the 'var = const' clauses, the 'var = var'
clauses are redundant, and should be suppressed both to save work at
execution and to avoid double-counting restrictivity.
Diffstat (limited to 'src/backend/optimizer/path/indxpath.c')
-rw-r--r-- | src/backend/optimizer/path/indxpath.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index 02a92fd9960..443d54c6473 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.132 2003/01/20 18:54:49 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.133 2003/01/24 03:58:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1596,12 +1596,14 @@ make_innerjoin_index_path(Query *root, * nconc the two lists; then we might have some restriction * clauses appearing twice, which'd mislead * restrictlist_selectivity into double-counting their - * selectivity.) + * selectivity. However, since RestrictInfo nodes aren't copied when + * linking them into different lists, it should be sufficient to use + * pointer comparison to remove duplicates.) */ pathnode->rows = rel->tuples * restrictlist_selectivity(root, - set_union(rel->baserestrictinfo, - clausegroup), + set_ptrUnion(rel->baserestrictinfo, + clausegroup), lfirsti(rel->relids)); /* Like costsize.c, force estimate to be at least one row */ if (pathnode->rows < 1.0) |