aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util/relnode.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-04-21 21:01:45 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-04-21 21:01:45 +0000
commitafcf09dd9034f24e34dd46f69938882ab5b103d2 (patch)
tree497edd9a542b2bc9312afe2f39341f7b95a892c5 /src/backend/optimizer/util/relnode.c
parentac7e6c0665a377fb0e4e5b12cfc762c1b14e425e (diff)
downloadpostgresql-afcf09dd9034f24e34dd46f69938882ab5b103d2.tar.gz
postgresql-afcf09dd9034f24e34dd46f69938882ab5b103d2.zip
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.
Diffstat (limited to 'src/backend/optimizer/util/relnode.c')
-rw-r--r--src/backend/optimizer/util/relnode.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
index 6dfd2f61149..56f8f3493c2 100644
--- a/src/backend/optimizer/util/relnode.c
+++ b/src/backend/optimizer/util/relnode.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.86 2007/02/22 22:00:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.87 2007/04/21 21:01:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,15 +56,15 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptKind reloptkind)
RelOptInfo *rel;
RangeTblEntry *rte;
- /* Fetch RTE for relation */
- Assert(relid > 0 && relid <= list_length(root->parse->rtable));
- rte = rt_fetch(relid, root->parse->rtable);
-
/* Rel should not exist already */
- Assert(relid < root->simple_rel_array_size);
+ Assert(relid > 0 && relid < root->simple_rel_array_size);
if (root->simple_rel_array[relid] != NULL)
elog(ERROR, "rel %d already exists", relid);
+ /* Fetch RTE for relation */
+ rte = root->simple_rte_array[relid];
+ Assert(rte != NULL);
+
rel = makeNode(RelOptInfo);
rel->reloptkind = reloptkind;
rel->relids = bms_make_singleton(relid);