1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-28 11:55:03 +03:00

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.
This commit is contained in:
Tom Lane
2007-04-21 21:01:45 +00:00
parent ac7e6c0665
commit afcf09dd90
11 changed files with 91 additions and 42 deletions

View File

@@ -54,7 +54,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.180 2007/04/21 02:41:13 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.181 2007/04/21 21:01:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -856,7 +856,7 @@ cost_functionscan(Path *path, PlannerInfo *root, RelOptInfo *baserel)
/* Should only be applied to base relations that are functions */
Assert(baserel->relid > 0);
rte = rt_fetch(baserel->relid, root->parse->rtable);
rte = planner_rt_fetch(baserel->relid, root);
Assert(rte->rtekind == RTE_FUNCTION);
/* Estimate costs of executing the function expression */
@@ -2297,7 +2297,7 @@ set_function_size_estimates(PlannerInfo *root, RelOptInfo *rel)
/* Should only be applied to base relations that are functions */
Assert(rel->relid > 0);
rte = rt_fetch(rel->relid, root->parse->rtable);
rte = planner_rt_fetch(rel->relid, root);
Assert(rte->rtekind == RTE_FUNCTION);
/* Estimate number of rows the function itself will return */
@@ -2323,7 +2323,7 @@ set_values_size_estimates(PlannerInfo *root, RelOptInfo *rel)
/* Should only be applied to base relations that are values lists */
Assert(rel->relid > 0);
rte = rt_fetch(rel->relid, root->parse->rtable);
rte = planner_rt_fetch(rel->relid, root);
Assert(rte->rtekind == RTE_VALUES);
/*