summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/path')
-rw-r--r--src/backend/optimizer/path/costsize.c6
-rw-r--r--src/backend/optimizer/path/joinpath.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 10d41141f2b..957f751bd48 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -4023,6 +4023,7 @@ get_restriction_qual_cost(PlannerInfo *root, RelOptInfo *baserel,
* them to all the join cost estimation functions.
*
* Input parameters:
+ * joinrel: join relation under consideration
* outerrel: outer relation under consideration
* innerrel: inner relation under consideration
* jointype: if not JOIN_SEMI or JOIN_ANTI, we assume it's inner_unique
@@ -4033,6 +4034,7 @@ get_restriction_qual_cost(PlannerInfo *root, RelOptInfo *baserel,
*/
void
compute_semi_anti_join_factors(PlannerInfo *root,
+ RelOptInfo *joinrel,
RelOptInfo *outerrel,
RelOptInfo *innerrel,
JoinType jointype,
@@ -4056,14 +4058,12 @@ compute_semi_anti_join_factors(PlannerInfo *root,
*/
if (IS_OUTER_JOIN(jointype))
{
- Relids joinrelids = bms_union(outerrel->relids, innerrel->relids);
-
joinquals = NIL;
foreach(l, restrictlist)
{
RestrictInfo *rinfo = lfirst_node(RestrictInfo, l);
- if (!RINFO_IS_PUSHED_DOWN(rinfo, joinrelids))
+ if (!RINFO_IS_PUSHED_DOWN(rinfo, joinrel->relids))
joinquals = lappend(joinquals, rinfo);
}
}
diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c
index f47dd8185b5..450edfae464 100644
--- a/src/backend/optimizer/path/joinpath.c
+++ b/src/backend/optimizer/path/joinpath.c
@@ -171,6 +171,7 @@ add_paths_to_joinrel(PlannerInfo *root,
break;
case JOIN_UNIQUE_OUTER:
extra.inner_unique = innerrel_is_unique(root,
+ joinrel->relids,
outerrel->relids,
innerrel,
JOIN_INNER,
@@ -179,6 +180,7 @@ add_paths_to_joinrel(PlannerInfo *root,
break;
default:
extra.inner_unique = innerrel_is_unique(root,
+ joinrel->relids,
outerrel->relids,
innerrel,
jointype,
@@ -207,7 +209,7 @@ add_paths_to_joinrel(PlannerInfo *root,
* for cost estimation. These will be the same for all paths.
*/
if (jointype == JOIN_SEMI || jointype == JOIN_ANTI || extra.inner_unique)
- compute_semi_anti_join_factors(root, outerrel, innerrel,
+ compute_semi_anti_join_factors(root, joinrel, outerrel, innerrel,
jointype, sjinfo, restrictlist,
&extra.semifactors);