1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

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.
This commit is contained in:
Tom Lane
2005-05-22 22:30:20 +00:00
parent c61207b091
commit e2159f3842
13 changed files with 605 additions and 177 deletions

View File

@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.188 2005/04/25 04:27:12 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.189 2005/05/22 22:30:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -308,10 +308,11 @@ use_physical_tlist(RelOptInfo *rel)
int i;
/*
* Currently, can't do this for subquery or function scans. (This is
* mainly because we don't have an equivalent of build_physical_tlist
* for them; worth adding?)
* OK for subquery scans, but not function scans. (This is mainly
* because build_physical_tlist doesn't support them; worth adding?)
*/
if (rel->rtekind == RTE_SUBQUERY)
return true;
if (rel->rtekind != RTE_RELATION)
return false;