Skip to content

Commit 07e6f93

Browse files
committed
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.
1 parent c6b9924 commit 07e6f93

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/backend/optimizer/path/clausesel.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.73 2005/06/05 22:32:55 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.74 2005/10/11 16:44:40 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -461,8 +461,15 @@ clause_selectivity(PlannerInfo *root,
461461
}
462462
}
463463

464-
/* Proceed with examination of contained clause */
465-
clause = (Node *) rinfo->clause;
464+
/*
465+
* Proceed with examination of contained clause. If the clause is an
466+
* OR-clause, we want to look at the variant with sub-RestrictInfos,
467+
* so that per-subclause selectivities can be cached.
468+
*/
469+
if (rinfo->orclause)
470+
clause = (Node *) rinfo->orclause;
471+
else
472+
clause = (Node *) rinfo->clause;
466473
}
467474

468475
if (IsA(clause, Var))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy