diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-10-11 16:44:40 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-10-11 16:44:40 +0000 |
commit | 07e6f93d6b41aaacaf5d2bf758f52ef37f0a6e5b (patch) | |
tree | 43fea4db70ebe7ca6e84bac3bf674c60268d41bd /src/backend | |
parent | c6b9924bec6f621f9bbceb38d7839a83c148c6ce (diff) | |
download | postgresql-07e6f93d6b41aaacaf5d2bf758f52ef37f0a6e5b.tar.gz postgresql-07e6f93d6b41aaacaf5d2bf758f52ef37f0a6e5b.zip |
Fix oversight in 8.0 modification of RestrictInfo data structures.
A RestrictInfo representing an OR clause now contains two versions of
the contained expression, one with sub-RestrictInfos and one without.
clause_selectivity() should descend to the version with sub-RestrictInfos
so that it has a chance of caching its results for the OR's sub-clauses.
Failing to do so resulted in redundant planner effort.
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/optimizer/path/clausesel.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c index f6cd3432751..aad977164a7 100644 --- a/src/backend/optimizer/path/clausesel.c +++ b/src/backend/optimizer/path/clausesel.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.73 2005/06/05 22:32:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.74 2005/10/11 16:44:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -461,8 +461,15 @@ clause_selectivity(PlannerInfo *root, } } - /* Proceed with examination of contained clause */ - clause = (Node *) rinfo->clause; + /* + * Proceed with examination of contained clause. If the clause is an + * OR-clause, we want to look at the variant with sub-RestrictInfos, + * so that per-subclause selectivities can be cached. + */ + if (rinfo->orclause) + clause = (Node *) rinfo->orclause; + else + clause = (Node *) rinfo->clause; } if (IsA(clause, Var)) |