diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-12-07 18:56:14 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-12-07 18:56:17 -0500 |
commit | edca44b1525b3d591263d032dc4fe500ea771e0e (patch) | |
tree | 1b298a9c8f16630e7feceba17f50fd49e1446055 /src/include/nodes/relation.h | |
parent | 7ac5d9b31637b1856c7ac9cb625bcca694a2790a (diff) | |
download | postgresql-edca44b1525b3d591263d032dc4fe500ea771e0e.tar.gz postgresql-edca44b1525b3d591263d032dc4fe500ea771e0e.zip |
Simplify LATERAL-related calculations within add_paths_to_joinrel().
While convincing myself that commit 7e19db0c09719d79 would solve both of
the problems recently reported by Andreas Seltenreich, I realized that
add_paths_to_joinrel's handling of LATERAL restrictions could be made
noticeably simpler and faster if we were to retain the minimum possible
parameterization for each joinrel (that is, the set of relids supplying
unsatisfied lateral references in it). We already retain that for
baserels, in RelOptInfo.lateral_relids, so we can use that field for
joinrels too.
I re-pgindent'd the files touched here, which affects some unrelated
comments.
This is, I believe, just a minor optimization not a bug fix, so no
back-patch.
Diffstat (limited to 'src/include/nodes/relation.h')
-rw-r--r-- | src/include/nodes/relation.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index 9a0dd28195f..6de07a1fbd0 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -99,15 +99,15 @@ typedef struct PlannerGlobal Index lastRowMarkId; /* highest PlanRowMark ID assigned */ - int lastPlanNodeId; /* highest plan node ID assigned */ + int lastPlanNodeId; /* highest plan node ID assigned */ bool transientPlan; /* redo plan when TransactionXmin changes? */ bool hasRowSecurity; /* row security applied? */ - bool parallelModeOK; /* parallel mode potentially OK? */ + bool parallelModeOK; /* parallel mode potentially OK? */ - bool parallelModeNeeded; /* parallel mode actually required? */ + bool parallelModeNeeded; /* parallel mode actually required? */ } PlannerGlobal; /* macro for fetching the Plan associated with a SubPlan node */ @@ -357,6 +357,7 @@ typedef struct PlannerInfo * (no duplicates) output from relation; NULL if not yet requested * cheapest_parameterized_paths - best paths for their parameterizations; * always includes cheapest_total_path, even if that's unparameterized + * lateral_relids - required outer rels for LATERAL, as a Relids set * * If the relation is a base relation it will have these fields set: * @@ -371,8 +372,6 @@ typedef struct PlannerInfo * zero means not computed yet * lateral_vars - lateral cross-references of rel, if any (list of * Vars and PlaceHolderVars) - * lateral_relids - required outer rels for LATERAL, as a Relids set - * (for child rels this can be more than lateral_vars) * lateral_referencers - relids of rels that reference this one laterally * indexlist - list of IndexOptInfo nodes for relation's indexes * (always NIL if it's not a table) @@ -388,7 +387,7 @@ typedef struct PlannerInfo * set_subquery_pathlist processes the object. * * For otherrels that are appendrel members, these fields are filled - * in just as for a baserel. + * in just as for a baserel, except we don't bother with lateral_vars. * * If the relation is either a foreign table or a join of foreign tables that * all belong to the same foreign server, these fields will be set: @@ -463,6 +462,10 @@ typedef struct RelOptInfo struct Path *cheapest_unique_path; List *cheapest_parameterized_paths; + /* parameterization information needed for both base rels and join rels */ + /* (see also lateral_vars and lateral_referencers) */ + Relids lateral_relids; /* minimum parameterization of rel */ + /* information about a base rel (not set for join rels!) */ Index relid; Oid reltablespace; /* containing tablespace */ @@ -472,7 +475,6 @@ typedef struct RelOptInfo Relids *attr_needed; /* array indexed [min_attr .. max_attr] */ int32 *attr_widths; /* array indexed [min_attr .. max_attr] */ List *lateral_vars; /* LATERAL Vars and PHVs referenced by rel */ - Relids lateral_relids; /* minimum parameterization of rel */ Relids lateral_referencers; /* rels that reference me laterally */ List *indexlist; /* list of IndexOptInfo */ BlockNumber pages; /* size estimates derived from pg_class */ @@ -1717,7 +1719,6 @@ typedef struct SemiAntiJoinFactors * sjinfo is extra info about special joins for selectivity estimation * semifactors is as shown above (only valid for SEMI or ANTI joins) * param_source_rels are OK targets for parameterization of result paths - * extra_lateral_rels are additional parameterization for result paths */ typedef struct JoinPathExtraData { @@ -1726,7 +1727,6 @@ typedef struct JoinPathExtraData SpecialJoinInfo *sjinfo; SemiAntiJoinFactors semifactors; Relids param_source_rels; - Relids extra_lateral_rels; } JoinPathExtraData; /* |