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/include | |
parent | 0d3e36b6687ae601551fb8047c10a68f2d6fb565 (diff) | |
download | postgresql-4cff59d8d540c441fb0c22dfaa517bc25aa5f794.tar.gz postgresql-4cff59d8d540c441fb0c22dfaa517bc25aa5f794.zip |
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/include')
-rw-r--r-- | src/include/executor/executor.h | 3 | ||||
-rw-r--r-- | src/include/nodes/relation.h | 4 | ||||
-rw-r--r-- | src/include/optimizer/plancat.h | 7 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index cd462ac27a0..2f329ca57af 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: executor.h,v 1.87 2003/01/12 04:03:34 tgl Exp $ + * $Id: executor.h,v 1.88 2003/02/03 15:07:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -137,6 +137,7 @@ extern TupleTableSlot *ExecProject(ProjectionInfo *projInfo, typedef TupleTableSlot *(*ExecScanAccessMtd) (ScanState *node); extern TupleTableSlot *ExecScan(ScanState *node, ExecScanAccessMtd accessMtd); +extern void ExecAssignScanProjectionInfo(ScanState *node); /* * prototypes from functions in execTuples.c diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index c2d8970234f..807c70073de 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: relation.h,v 1.77 2003/01/20 18:55:04 tgl Exp $ + * $Id: relation.h,v 1.78 2003/02/03 15:07:08 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -105,6 +105,7 @@ typedef struct QualCost * If the relation is a base relation it will have these fields set: * * rtekind - distinguishes plain relation, subquery, or function RTE + * varlist - list of Vars for physical columns (only if table) * indexlist - list of IndexOptInfo nodes for relation's indexes * (always NIL if it's not a table) * pages - number of disk pages in relation (zero if not a table) @@ -190,6 +191,7 @@ typedef struct RelOptInfo /* information about a base rel (not set for join rels!) */ RTEKind rtekind; /* RELATION, SUBQUERY, or FUNCTION */ + List *varlist; List *indexlist; long pages; double tuples; diff --git a/src/include/optimizer/plancat.h b/src/include/optimizer/plancat.h index 255d196d7d7..c6b18ab0da9 100644 --- a/src/include/optimizer/plancat.h +++ b/src/include/optimizer/plancat.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: plancat.h,v 1.28 2003/01/28 22:13:41 tgl Exp $ + * $Id: plancat.h,v 1.29 2003/02/03 15:07:08 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,10 +17,7 @@ #include "nodes/relation.h" -extern void get_relation_info(Oid relationObjectId, - bool *hasindex, long *pages, double *tuples); - -extern List *find_secondary_indexes(Oid relationObjectId); +extern void get_relation_info(Oid relationObjectId, RelOptInfo *rel); extern List *find_inheritance_children(Oid inhparent); |