summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/planner.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-05-22 22:30:20 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-05-22 22:30:20 +0000
commite2159f384268e01282af60515582943bf595ba7b (patch)
tree89fa7f4dce0cb8ed7a3296e08e30e71c01f7f84f /src/backend/optimizer/plan/planner.c
parentc61207b0913b947d17b837a3d532de81a385977d (diff)
downloadpostgresql-e2159f384268e01282af60515582943bf595ba7b.tar.gz
Teach the planner to remove SubqueryScan nodes from the plan if they
aren't doing anything useful (ie, neither selection nor projection). Also, extend to SubqueryScan the hacks already in place to avoid unnecessary ExecProject calls when the result would just be the same tuple the subquery already delivered. This saves some overhead in UNION and other set operations, as well as avoiding overhead for unflatten-able subqueries. Per example from Sokolov Yura.
Diffstat (limited to 'src/backend/optimizer/plan/planner.c')
-rw-r--r--src/backend/optimizer/plan/planner.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 2e83a7417d..c14983baa0 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.185 2005/04/28 21:47:13 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.186 2005/05/22 22:30:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -144,12 +144,12 @@ planner(Query *parse, bool isCursor, int cursorOptions,
result_plan = materialize_finished_plan(result_plan);
}
+ /* final cleanup of the plan */
+ result_plan = set_plan_references(result_plan, parse->rtable);
+
/* executor wants to know total number of Params used overall */
result_plan->nParamExec = list_length(PlannerParamList);
- /* final cleanup of the plan */
- set_plan_references(result_plan, parse->rtable);
-
/* restore state for outer planner, if any */
PlannerQueryLevel = save_PlannerQueryLevel;
PlannerParamList = save_PlannerParamList;