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

Commit1446379

Browse files
committed
fix param. paths, use all paths from innerrel->pathlist
1 parent761a41c commit1446379

File tree

1 file changed

+39
-34
lines changed

1 file changed

+39
-34
lines changed

‎pickyappend.c

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,16 @@ get_partition_oids(List *ranges, int *n, PartRelationInfo *prel)
179179

180180
staticPath*
181181
create_pickyappend_path(PlannerInfo*root,
182-
RelOptInfo*joinrel,
183-
RelOptInfo*outerrel,
184-
RelOptInfo*innerrel,
185-
ParamPathInfo*param_info,
186-
JoinPathExtraData*extra)
182+
AppendPath*inner_append,
183+
ParamPathInfo*param_info,
184+
JoinPathExtraData*extra)
187185
{
188-
AppendPath*inner_append=(AppendPath*)linitial(innerrel->cheapest_parameterized_paths);
189-
List*joinrestrictclauses=extra->restrictlist;
190-
List*joinclauses;
191-
List*otherclauses;
192-
ListCell*lc;
193-
inti;
186+
RelOptInfo*innerrel=inner_append->path.parent;
187+
List*joinrestrictclauses=extra->restrictlist;
188+
List*joinclauses;
189+
List*otherclauses;
190+
ListCell*lc;
191+
inti;
194192

195193
RangeTblEntry*inner_entry=root->simple_rte_array[innerrel->relid];
196194

@@ -272,6 +270,7 @@ pathman_join_pathlist_hook(PlannerInfo *root,
272270
PartRelationInfo*inner_prel;
273271
NestPath*nest_path;
274272
List*pathkeys=NIL;
273+
ListCell*lc;
275274

276275
if (set_join_pathlist_next)
277276
set_join_pathlist_next(root,joinrel,outerrel,
@@ -280,38 +279,44 @@ pathman_join_pathlist_hook(PlannerInfo *root,
280279
if (jointype==JOIN_FULL|| !pg_pathman_enable_pickyappend)
281280
return;
282281

283-
if (innerrel->reloptkind==RELOPT_BASEREL&&
284-
inner_entry->inh&&
285-
IsA(linitial(innerrel->cheapest_parameterized_paths),AppendPath)&&
286-
(inner_prel=get_pathman_relation_info(inner_entry->relid,NULL)))
282+
if (innerrel->reloptkind!=RELOPT_BASEREL||
283+
!inner_entry->inh||
284+
!(inner_prel=get_pathman_relation_info(inner_entry->relid,NULL)))
287285
{
288-
elog(LOG,"adding new nestloop path with pickyappend");
286+
return;/* Obviously not our case */
289287
}
290-
elsereturn;
291288

292-
outer=outerrel->cheapest_total_path;
289+
foreach (lc,innerrel->pathlist)
290+
{
291+
AppendPath*cur_inner_path= (AppendPath*)lfirst(lc);
293292

294-
inner_required=bms_union(PATH_REQ_OUTER((Path*)linitial(innerrel->cheapest_parameterized_paths)),
295-
bms_make_singleton(outerrel->relid));
293+
if (!IsA(cur_inner_path,AppendPath))
294+
continue;
296295

297-
inner=create_pickyappend_path(root,joinrel,outerrel,innerrel,
298-
get_appendrel_parampathinfo(innerrel,
299-
inner_required),
300-
extra);
296+
outer=outerrel->cheapest_total_path;
301297

302-
initial_cost_nestloop(root,&workspace,jointype,
303-
outer,inner,
304-
extra->sjinfo,&extra->semifactors);
298+
inner_required=bms_union(PATH_REQ_OUTER((Path*)cur_inner_path),
299+
bms_make_singleton(outerrel->relid));
305300

306-
pathkeys=build_join_pathkeys(root,joinrel,jointype,outer->pathkeys);
301+
inner=create_pickyappend_path(root,cur_inner_path,
302+
get_appendrel_parampathinfo(innerrel,
303+
inner_required),
304+
extra);
307305

308-
nest_path=create_nestloop_path(root,joinrel,jointype,&workspace,
309-
extra->sjinfo,&extra->semifactors,
310-
outer,inner,extra->restrictlist,
311-
pathkeys,
312-
calc_nestloop_required_outer(outer,inner));
306+
initial_cost_nestloop(root,&workspace,jointype,
307+
outer,inner,
308+
extra->sjinfo,&extra->semifactors);
313309

314-
add_path(joinrel, (Path*)nest_path);
310+
pathkeys=build_join_pathkeys(root,joinrel,jointype,outer->pathkeys);
311+
312+
nest_path=create_nestloop_path(root,joinrel,jointype,&workspace,
313+
extra->sjinfo,&extra->semifactors,
314+
outer,inner,extra->restrictlist,
315+
pathkeys,
316+
calc_nestloop_required_outer(outer,inner));
317+
318+
add_path(joinrel, (Path*)nest_path);
319+
}
315320
}
316321

317322
staticvoid

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp