From afcf09dd9034f24e34dd46f69938882ab5b103d2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 21 Apr 2007 21:01:45 +0000 Subject: Some further performance tweaks for planning large inheritance trees that are mostly excluded by constraints: do the CE test a bit earlier to save some adjust_appendrel_attrs() work on excluded children, and arrange to use array indexing rather than rt_fetch() to fetch RTEs in the main body of the planner. The latter is something I'd wanted to do for awhile anyway, but seeing list_nth_cell() as 35% of the runtime gets one's attention. --- src/backend/optimizer/util/plancat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/backend/optimizer/util/plancat.c') diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index 33b081ffffd..662fcbaaf8e 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.133 2007/04/06 22:33:42 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.134 2007/04/21 21:01:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -497,6 +497,9 @@ get_relation_constraints(Oid relationObjectId, RelOptInfo *rel) * Detect whether the relation need not be scanned because it has either * self-inconsistent restrictions, or restrictions inconsistent with the * relation's CHECK constraints. + * + * Note: this examines only rel->relid and rel->baserestrictinfo; therefore + * it can be called before filling in other fields of the RelOptInfo. */ bool relation_excluded_by_constraints(RelOptInfo *rel, RangeTblEntry *rte) @@ -595,7 +598,7 @@ build_physical_tlist(PlannerInfo *root, RelOptInfo *rel) { List *tlist = NIL; Index varno = rel->relid; - RangeTblEntry *rte = rt_fetch(varno, root->parse->rtable); + RangeTblEntry *rte = planner_rt_fetch(varno, root); Relation relation; Query *subquery; Var *var; -- cgit v1.2.3