diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-08-15 12:30:38 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-08-15 12:30:38 -0400 |
commit | e139f1953f29db245f60a7acb72fccb1e05d2442 (patch) | |
tree | 783ae7f36a8066e9057d5ee275d5cc97870f8ee3 /src/backend/optimizer/util/pathnode.c | |
parent | 00418c61244138bd8ac2de58076a1d0dd4f539f3 (diff) | |
download | postgresql-e139f1953f29db245f60a7acb72fccb1e05d2442.tar.gz postgresql-e139f1953f29db245f60a7acb72fccb1e05d2442.zip |
Assorted preparatory refactoring for partition-wise join.
Instead of duplicating the logic to search for a matching
ParamPathInfo in multiple places, factor it out into a separate
function.
Pass only the relevant bits of the PartitionKey to
partition_bounds_equal instead of the whole thing, because
partition-wise join will want to call this without having a
PartitionKey available.
Adjust allow_star_schema_join and calc_nestloop_required_outer
to take relevant Relids rather than the entire Path, because
partition-wise join will want to call it with the top-parent
relids to determine whether a child join is allowable.
Ashutosh Bapat. Review and testing of the larger patch set of which
this is a part by Amit Langote, Rajkumar Raghuwanshi, Rafia Sabih,
Thomas Munro, Dilip Kumar, and me.
Discussion: http://postgr.es/m/CA+TgmobQK80vtXjAsPZWWXd7c8u13G86gmuLupN+uUJjA+i4nA@mail.gmail.com
Diffstat (limited to 'src/backend/optimizer/util/pathnode.c')
-rw-r--r-- | src/backend/optimizer/util/pathnode.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index f2d6385f183..26567cb7f65 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -1993,14 +1993,15 @@ create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel, * Note: result must not share storage with either input */ Relids -calc_nestloop_required_outer(Path *outer_path, Path *inner_path) +calc_nestloop_required_outer(Relids outerrelids, + Relids outer_paramrels, + Relids innerrelids, + Relids inner_paramrels) { - Relids outer_paramrels = PATH_REQ_OUTER(outer_path); - Relids inner_paramrels = PATH_REQ_OUTER(inner_path); Relids required_outer; /* inner_path can require rels from outer path, but not vice versa */ - Assert(!bms_overlap(outer_paramrels, inner_path->parent->relids)); + Assert(!bms_overlap(outer_paramrels, innerrelids)); /* easy case if inner path is not parameterized */ if (!inner_paramrels) return bms_copy(outer_paramrels); @@ -2008,7 +2009,7 @@ calc_nestloop_required_outer(Path *outer_path, Path *inner_path) required_outer = bms_union(outer_paramrels, inner_paramrels); /* ... and remove any mention of now-satisfied outer rels */ required_outer = bms_del_members(required_outer, - outer_path->parent->relids); + outerrelids); /* maintain invariant that required_outer is exactly NULL if empty */ if (bms_is_empty(required_outer)) { |