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

Commita789fa2

Browse files
committed
Merge branch 'master' into rework_query_walkers
2 parentsae81df2 +e710bbf commita789fa2

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

‎src/hooks.c

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,21 @@ pathman_join_pathlist_hook(PlannerInfo *root,
9999
paramsel *=wrap->paramsel;
100100
}
101101

102-
/* Check that innerrel'sRestrictInfo contains partitioned column */
102+
/* Check that innerrel'sRestrictInfos contain partitioned column */
103103
innerrel_rinfo_contains_part_attr=
104104
get_partitioned_attr_clauses(innerrel->baserestrictinfo,
105105
inner_prel,innerrel->relid)!=NULL;
106106

107107
foreach (lc,innerrel->pathlist)
108108
{
109+
AppendPath*cur_inner_path= (AppendPath*)lfirst(lc);
109110
Path*outer,
110111
*inner;
111112
NestPath*nest_path;/* NestLoop we're creating */
112113
ParamPathInfo*ppi;/* parameterization info */
113114
Relidsinner_required;/* required paremeterization relids */
114-
AppendPath*cur_inner_path= (AppendPath*)lfirst(lc);
115+
List*filtered_joinclauses=NIL;
116+
ListCell*rinfo_lc;
115117

116118
if (!IsA(cur_inner_path,AppendPath))
117119
continue;
@@ -136,8 +138,7 @@ pathman_join_pathlist_hook(PlannerInfo *root,
136138
innerrel->relid))))
137139
continue;
138140

139-
inner=create_runtimeappend_path(root,cur_inner_path,
140-
ppi,paramsel);
141+
inner=create_runtimeappend_path(root,cur_inner_path,ppi,paramsel);
141142

142143
initial_cost_nestloop(root,&workspace,jointype,
143144
outer,inner,/* built paths */
@@ -151,7 +152,29 @@ pathman_join_pathlist_hook(PlannerInfo *root,
151152
pathkeys,
152153
calc_nestloop_required_outer(outer,inner));
153154

154-
/* Finally we can add new NestLoop path */
155+
/* Discard all clauses that are to be evaluated by 'inner' */
156+
foreach (rinfo_lc,extra->restrictlist)
157+
{
158+
RestrictInfo*rinfo= (RestrictInfo*)lfirst(rinfo_lc);
159+
160+
Assert(IsA(rinfo,RestrictInfo));
161+
if (!join_clause_is_movable_to(rinfo,inner->parent))
162+
filtered_joinclauses=lappend(filtered_joinclauses,rinfo);
163+
}
164+
165+
/*
166+
* Override 'rows' value produced by standard estimator.
167+
* Currently we use get_parameterized_joinrel_size() since
168+
* it works just fine, but this might change some day.
169+
*/
170+
nest_path->path.rows=get_parameterized_joinrel_size(root,
171+
joinrel,
172+
outer->rows,
173+
inner->rows,
174+
extra->sjinfo,
175+
filtered_joinclauses);
176+
177+
/* Finally we can add the new NestLoop path */
155178
add_path(joinrel, (Path*)nest_path);
156179
}
157180
}

‎src/pg_pathman.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,6 @@ handle_boolexpr(const BoolExpr *expr, WalkerContext *context)
15101510
switch (expr->boolop)
15111511
{
15121512
caseOR_EXPR:
1513-
// finish_least_greatest(arg, context);
15141513
result->rangeset=irange_list_union(result->rangeset,arg->rangeset);
15151514
break;
15161515
caseAND_EXPR:
@@ -1671,7 +1670,6 @@ set_plain_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte)
16711670
path=create_seqscan_path(root,rel,required_outer);
16721671
#endif
16731672
add_path(rel,path);
1674-
// set_pathkeys(root, rel, path);
16751673

16761674
/* Consider index scans */
16771675
create_index_paths(root,rel);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp