Teach the planner to remove SubqueryScan nodes from the plan if they
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 22 May 2005 22:30:20 +0000 (22:30 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 22 May 2005 22:30:20 +0000 (22:30 +0000)
commite2159f384268e01282af60515582943bf595ba7b
tree89fa7f4dce0cb8ed7a3296e08e30e71c01f7f84f
parentc61207b0913b947d17b837a3d532de81a385977d
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.
13 files changed:
src/backend/executor/execMain.c
src/backend/executor/execScan.c
src/backend/executor/nodeAppend.c
src/backend/executor/nodeFunctionscan.c
src/backend/executor/nodeSubqueryscan.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/util/clauses.c
src/backend/optimizer/util/plancat.c
src/include/optimizer/clauses.h
src/include/optimizer/planmain.h