1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-28 11:55:03 +03:00

Tweak a couple of planner APIs to save recalculating join relids.

Discussion: https://postgr.es/m/f8128b11-c5bf-3539-48cd-234178b2314d@proxel.se
This commit is contained in:
Tom Lane
2018-04-20 16:00:47 -04:00
parent c792c7db41
commit ec38dcd363
5 changed files with 16 additions and 9 deletions

View File

@@ -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);
}
}