Skip to content

Commit f47b33a

Browse files
author
Richard Guo
committed
Simplify create_merge_append_path for clarity
We don't currently support parameterized MergeAppend paths: there's little use for an ordered path on the inside of a nestloop. Given this, we can simplify create_merge_append_path by directly setting param_info to NULL instead of calling get_appendrel_parampathinfo. We can also simplify the Assert for child paths a little bit. This change won't make any measurable difference in performance; it's just for clarity's sake. Author: Richard Guo Reviewed-by: Alena Rybakina, Paul A Jungwirth Discussion: https://postgr.es/m/CAMbWs4_n1bgH2nACMuGsXZct3KH6PBFS0tPdQsXdstRfyxTunQ@mail.gmail.com
1 parent 2e68077 commit f47b33a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/backend/optimizer/util/pathnode.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,11 +1423,16 @@ create_merge_append_path(PlannerInfo *root,
14231423
Cost input_total_cost;
14241424
ListCell *l;
14251425

1426+
/*
1427+
* We don't currently support parameterized MergeAppend paths, as
1428+
* explained in the comments for generate_orderedappend_paths.
1429+
*/
1430+
Assert(bms_is_empty(rel->lateral_relids) && bms_is_empty(required_outer));
1431+
14261432
pathnode->path.pathtype = T_MergeAppend;
14271433
pathnode->path.parent = rel;
14281434
pathnode->path.pathtarget = rel->reltarget;
1429-
pathnode->path.param_info = get_appendrel_parampathinfo(rel,
1430-
required_outer);
1435+
pathnode->path.param_info = NULL;
14311436
pathnode->path.parallel_aware = false;
14321437
pathnode->path.parallel_safe = rel->consider_parallel;
14331438
pathnode->path.parallel_workers = 0;
@@ -1453,6 +1458,9 @@ create_merge_append_path(PlannerInfo *root,
14531458
{
14541459
Path *subpath = (Path *) lfirst(l);
14551460

1461+
/* All child paths should be unparameterized */
1462+
Assert(bms_is_empty(PATH_REQ_OUTER(subpath)));
1463+
14561464
pathnode->path.rows += subpath->rows;
14571465
pathnode->path.parallel_safe = pathnode->path.parallel_safe &&
14581466
subpath->parallel_safe;
@@ -1480,9 +1488,6 @@ create_merge_append_path(PlannerInfo *root,
14801488
input_startup_cost += sort_path.startup_cost;
14811489
input_total_cost += sort_path.total_cost;
14821490
}
1483-
1484-
/* All child paths must have same parameterization */
1485-
Assert(bms_equal(PATH_REQ_OUTER(subpath), required_outer));
14861491
}
14871492

14881493
/*

0 commit comments

Comments
 (0)