diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-02-03 15:07:08 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-02-03 15:07:08 +0000 |
commit | 4cff59d8d540c441fb0c22dfaa517bc25aa5f794 (patch) | |
tree | 88b4c216d219582904d3d9d6a236bb9468fe148c /src/backend/optimizer/util/relnode.c | |
parent | 0d3e36b6687ae601551fb8047c10a68f2d6fb565 (diff) |
Tweak planner and executor to avoid doing ExecProject() in table scan
nodes where it's not really necessary. In many cases where the scan node
is not the topmost plan node (eg, joins, aggregation), it's possible to
just return the table tuple directly instead of generating an intermediate
projection tuple. In preliminary testing, this reduced the CPU time
needed for 'SELECT COUNT(*) FROM foo' by about 10%.
Diffstat (limited to 'src/backend/optimizer/util/relnode.c')
-rw-r--r-- | src/backend/optimizer/util/relnode.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c index 06a73bf4e9e..ebfaa4924d4 100644 --- a/src/backend/optimizer/util/relnode.c +++ b/src/backend/optimizer/util/relnode.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.45 2003/01/24 03:58:43 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.46 2003/02/03 15:07:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -143,6 +143,7 @@ make_base_rel(Query *root, int relid) rel->cheapest_unique_path = NULL; rel->pruneable = true; rel->rtekind = rte->rtekind; + rel->varlist = NIL; rel->indexlist = NIL; rel->pages = 0; rel->tuples = 0; @@ -159,16 +160,9 @@ make_base_rel(Query *root, int relid) switch (rte->rtekind) { case RTE_RELATION: - { - /* Table --- retrieve statistics from the system catalogs */ - bool indexed; - - get_relation_info(rte->relid, - &indexed, &rel->pages, &rel->tuples); - if (indexed) - rel->indexlist = find_secondary_indexes(rte->relid); - break; - } + /* Table --- retrieve statistics from the system catalogs */ + get_relation_info(rte->relid, rel); + break; case RTE_SUBQUERY: case RTE_FUNCTION: /* Subquery or function --- nothing to do here */ @@ -304,6 +298,7 @@ build_join_rel(Query *root, joinrel->cheapest_unique_path = NULL; joinrel->pruneable = true; joinrel->rtekind = RTE_JOIN; + joinrel->varlist = NIL; joinrel->indexlist = NIL; joinrel->pages = 0; joinrel->tuples = 0; |