Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb448f1c

Browse files
committed
Do assorted mop-up in the planner.
Remove RestrictInfo.nullable_relids, along with a good deal ofinfrastructure that calculated it. One use-case for it was injoin_clause_is_movable_to, but we can now replace that usage witha check to see if the clause's relids include any outer jointhat can null the target relation. The other use-case was injoin_clause_is_movable_into, but that test can just be droppedentirely now that the clause's relids include outer joins.Furthermore, join_clause_is_movable_into should now beaccurate enough that it will accept anything returned bygenerate_join_implied_equalities, so we can restore the Assertthat was diked out in commit95f4e59.Remove the outerjoin_delayed mechanism. We needed this before toprevent quals from getting evaluated below outer joins that shouldnull some of their vars. Now that we consider varnullingrels whileplacing quals, that's taken care of automatically, so throw thewhole thing away.Teach remove_useless_result_rtes to also remove useless FromExprs.Having done that, the delay_upper_joins flag serves no purpose anymore and we can remove it, largely reverting11086f2.Use constant TRUE for "dummy" clauses when throwing back outer joins.This improves on a hack I introduced in commit6a65225. If wehave a left-join clause l.x = r.y, and a WHERE clause l.x = constant,we generate r.y = constant and then don't really have a need for thejoin clause. But we must throw the join clause back anyway aftermarking it redundant, so that the join search heuristics won't thinkthis is a clauseless join and avoid it. That was a kluge introducedunder time pressure, and after looking at it I thought of a betterway: let's just introduce constant-TRUE "join clauses" instead,and get rid of them at the end. This improves the generated plans forsuch cases by not having to test a redundant join clause. We can alsoget rid of the ugly hack used to mark such clauses as redundant forselectivity estimation.Patch by me; thanks to Richard Guo for review.Discussion:https://postgr.es/m/830269.1656693747@sss.pgh.pa.us
1 parent2489d76 commitb448f1c

File tree

24 files changed

+325
-763
lines changed

24 files changed

+325
-763
lines changed

‎contrib/postgres_fdw/postgres_fdw.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6522,10 +6522,8 @@ foreign_grouping_ok(PlannerInfo *root, RelOptInfo *grouped_rel,
65226522
expr,
65236523
true,
65246524
false,
6525-
false,
65266525
root->qual_security_level,
65276526
grouped_rel->relids,
6528-
NULL,
65296527
NULL);
65306528
if (is_foreign_expr(root,grouped_rel,expr))
65316529
fpinfo->remote_conds=lappend(fpinfo->remote_conds,rinfo);

‎src/backend/optimizer/path/allpaths.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2745,7 +2745,6 @@ set_function_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte)
27452745
if (var)
27462746
pathkeys=build_expression_pathkey(root,
27472747
(Expr*)var,
2748-
NULL,/* below outer joins */
27492748
Int8LessOperator,
27502749
rel->relids,
27512750
false);

‎src/backend/optimizer/path/clausesel.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -715,12 +715,6 @@ clause_selectivity_ext(PlannerInfo *root,
715715
return (Selectivity)1.0;
716716
}
717717

718-
/*
719-
* If the clause is marked redundant, always return 1.0.
720-
*/
721-
if (rinfo->norm_selec>1)
722-
return (Selectivity)1.0;
723-
724718
/*
725719
* If possible, cache the result of the selectivity calculation for
726720
* the clause. We can cache if varRelid is zero or the clause

‎src/backend/optimizer/path/costsize.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4787,7 +4787,6 @@ compute_semi_anti_join_factors(PlannerInfo *root,
47874787
norm_sjinfo.commute_below=NULL;
47884788
/* we don't bother trying to make the remaining fields valid */
47894789
norm_sjinfo.lhs_strict= false;
4790-
norm_sjinfo.delay_upper_joins= false;
47914790
norm_sjinfo.semi_can_btree= false;
47924791
norm_sjinfo.semi_can_hash= false;
47934792
norm_sjinfo.semi_operators=NIL;
@@ -4956,7 +4955,6 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
49564955
sjinfo.commute_below=NULL;
49574956
/* we don't bother trying to make the remaining fields valid */
49584957
sjinfo.lhs_strict= false;
4959-
sjinfo.delay_upper_joins= false;
49604958
sjinfo.semi_can_btree= false;
49614959
sjinfo.semi_can_hash= false;
49624960
sjinfo.semi_operators=NIL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp