diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/nodes/relation.h | 47 | ||||
| -rw-r--r-- | src/include/optimizer/placeholder.h | 4 |
2 files changed, 39 insertions, 12 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index 96198aeec18..af8cb6be687 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -61,6 +61,25 @@ typedef struct AggClauseCosts Size transitionSpace; /* space for pass-by-ref transition data */ } AggClauseCosts; +/* + * This struct contains what we need to know during planning about the + * targetlist (output columns) that a Path will compute. Each RelOptInfo + * includes a default PathTarget, which its individual Paths may merely point + * to. However, in some cases a Path may compute outputs different from other + * Paths, and in that case we make a custom PathTarget struct for it. For + * example, an indexscan might return index expressions that would otherwise + * need to be explicitly calculated. + * + * Note that PathTarget.exprs is just a list of expressions; they do not have + * TargetEntry nodes on top, though those will appear in the finished Plan. + */ +typedef struct PathTarget +{ + List *exprs; /* list of expressions to be computed */ + QualCost cost; /* cost of evaluating the above */ + int width; /* estimated avg width of result tuples */ +} PathTarget; + /*---------- * PlannerGlobal @@ -334,17 +353,16 @@ typedef struct PlannerInfo * if there is just one, a join relation if more than one * rows - estimated number of tuples in the relation after restriction * clauses have been applied (ie, output rows of a plan for it) - * width - avg. number of bytes per tuple in the relation after the - * appropriate projections have been done (ie, output width) * consider_startup - true if there is any value in keeping plain paths for * this rel on the basis of having cheap startup cost * consider_param_startup - the same for parameterized paths - * reltargetlist - List of Var and PlaceHolderVar nodes for the values - * we need to output from this relation. - * List is in no particular order, but all rels of an - * appendrel set must use corresponding orders. - * NOTE: in an appendrel child relation, may contain - * arbitrary expressions pulled up from a subquery! + * reltarget - Default Path output tlist for this rel; normally contains + * Var and PlaceHolderVar nodes for the values we need to + * output from this relation. + * List is in no particular order, but all rels of an + * appendrel set must use corresponding orders. + * NOTE: in an appendrel child relation, may contain + * arbitrary expressions pulled up from a subquery! * pathlist - List of Path nodes, one for each potentially useful * method of generating the relation * ppilist - ParamPathInfo nodes for parameterized Paths, if any @@ -451,15 +469,16 @@ typedef struct RelOptInfo /* size estimates generated by planner */ double rows; /* estimated number of result tuples */ - int width; /* estimated avg width of result tuples */ /* per-relation planner control flags */ bool consider_startup; /* keep cheap-startup-cost paths? */ bool consider_param_startup; /* ditto, for parameterized paths? */ bool consider_parallel; /* consider parallel paths? */ + /* default result targetlist for Paths scanning this relation */ + PathTarget reltarget; /* list of Vars/Exprs, cost, width */ + /* materialization information */ - List *reltargetlist; /* Vars to be output by scan of relation */ List *pathlist; /* Path structures */ List *ppilist; /* ParamPathInfos used in pathlist */ List *partial_pathlist; /* partial Paths */ @@ -744,6 +763,11 @@ typedef struct ParamPathInfo * the same Path type for multiple Plan types when there is no need to * distinguish the Plan type during path processing. * + * "parent" identifies the relation this Path scans, and "pathtarget" + * describes the precise set of output columns the Path would compute. + * In simple cases all Paths for a given rel share the same targetlist, + * which we represent by having path->pathtarget point to parent->reltarget. + * * "param_info", if not NULL, links to a ParamPathInfo that identifies outer * relation(s) that provide parameter values to each scan of this path. * That means this path can only be joined to those rels by means of nestloop @@ -765,7 +789,10 @@ typedef struct Path NodeTag pathtype; /* tag identifying scan/join method */ RelOptInfo *parent; /* the relation this path can build */ + PathTarget *pathtarget; /* list of Vars/Exprs, cost, width */ + ParamPathInfo *param_info; /* parameterization info, or NULL if none */ + bool parallel_aware; /* engage parallel-aware logic? */ bool parallel_safe; /* OK to use as part of parallel plan? */ int parallel_degree; /* desired parallel degree; 0 = not parallel */ diff --git a/src/include/optimizer/placeholder.h b/src/include/optimizer/placeholder.h index 59c87ae70d6..54d0216ef83 100644 --- a/src/include/optimizer/placeholder.h +++ b/src/include/optimizer/placeholder.h @@ -26,7 +26,7 @@ extern void update_placeholder_eval_levels(PlannerInfo *root, SpecialJoinInfo *new_sjinfo); extern void fix_placeholder_input_needed_levels(PlannerInfo *root); extern void add_placeholders_to_base_rels(PlannerInfo *root); -extern void add_placeholders_to_joinrel(PlannerInfo *root, - RelOptInfo *joinrel); +extern void add_placeholders_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel, + RelOptInfo *outer_rel, RelOptInfo *inner_rel); #endif /* PLACEHOLDER_H */ |
