mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Restructure building of join relation targetlists so that a join plan
node emits only those vars that are actually needed above it in the plan tree. (There were comments in the code suggesting that this was done at some point in the dim past, but for a long time we have just made join nodes emit everything that either input emitted.) Aside from being marginally more efficient, this fixes the problem noted by Peter Eisentraut where a join above an IN-implemented-as-join might fail, because the subplan targetlist constructed in the latter case didn't meet the expectation of including everything. Along the way, fix some places that were O(N^2) in the targetlist length. This is not all the trouble spots for wide queries by any means, but it's a step forward.
This commit is contained in:
@@ -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.29 2003/02/03 15:07:08 tgl Exp $
|
||||
* $Id: plancat.h,v 1.30 2003/06/29 23:05:05 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
extern void get_relation_info(Oid relationObjectId, RelOptInfo *rel);
|
||||
|
||||
extern List *build_physical_tlist(Query *root, RelOptInfo *rel);
|
||||
|
||||
extern List *find_inheritance_children(Oid inhparent);
|
||||
|
||||
extern bool has_subclass(Oid relationId);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: planmain.h,v 1.71 2003/06/29 00:33:44 tgl Exp $
|
||||
* $Id: planmain.h,v 1.72 2003/06/29 23:05:05 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -56,7 +56,7 @@ extern Result *make_result(List *tlist, Node *resconstantqual, Plan *subplan);
|
||||
* prototypes for plan/initsplan.c
|
||||
*/
|
||||
extern void add_base_rels_to_query(Query *root, Node *jtnode);
|
||||
extern void build_base_rel_tlists(Query *root, List *tlist);
|
||||
extern void build_base_rel_tlists(Query *root, List *final_tlist);
|
||||
extern Relids distribute_quals_to_rels(Query *root, Node *jtnode);
|
||||
extern void process_implied_equality(Query *root,
|
||||
Node *item1, Node *item2,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: tlist.h,v 1.35 2003/05/06 00:20:33 tgl Exp $
|
||||
* $Id: tlist.h,v 1.36 2003/06/29 23:05:05 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
#include "nodes/relation.h"
|
||||
|
||||
|
||||
extern TargetEntry *tlistentry_member(Node *node, List *targetlist);
|
||||
extern Resdom *tlist_member(Node *node, List *targetlist);
|
||||
|
||||
extern void add_var_to_tlist(RelOptInfo *rel, Var *var);
|
||||
extern TargetEntry *create_tl_element(Var *var, int resdomno);
|
||||
|
||||
extern List *flatten_tlist(List *tlist);
|
||||
|
||||
Reference in New Issue
Block a user