1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-22 12:22:45 +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

@@ -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;