mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +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:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.78 2005/01/28 19:34:28 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.79 2005/05/22 22:30:20 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -87,9 +87,14 @@ extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (),
|
||||
#define QTW_DONT_COPY_QUERY 0x04 /* do not copy top Query */
|
||||
|
||||
extern bool query_tree_walker(Query *query, bool (*walker) (),
|
||||
void *context, int flags);
|
||||
void *context, int flags);
|
||||
extern Query *query_tree_mutator(Query *query, Node *(*mutator) (),
|
||||
void *context, int flags);
|
||||
void *context, int flags);
|
||||
|
||||
extern bool range_table_walker(List *rtable, bool (*walker) (),
|
||||
void *context, int flags);
|
||||
extern List *range_table_mutator(List *rtable, Node *(*mutator) (),
|
||||
void *context, int flags);
|
||||
|
||||
extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (),
|
||||
void *context, int flags);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.84 2005/04/25 02:14:48 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.85 2005/05/22 22:30:20 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -74,7 +74,7 @@ extern void process_implied_equality(Query *root,
|
||||
/*
|
||||
* prototypes for plan/setrefs.c
|
||||
*/
|
||||
extern void set_plan_references(Plan *plan, List *rtable);
|
||||
extern Plan *set_plan_references(Plan *plan, List *rtable);
|
||||
extern void fix_opfuncids(Node *node);
|
||||
extern void set_opfuncid(OpExpr *opexpr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user