diff options
author | Richard Guo <rguo@postgresql.org> | 2024-07-29 11:33:18 +0900 |
---|---|---|
committer | Richard Guo <rguo@postgresql.org> | 2024-07-29 11:33:18 +0900 |
commit | f47b33a19115f432ad80777db0d1350d23bb6cf5 (patch) | |
tree | caa38938fdbaad0a6e92ceeaa11a4ca9c4ebea70 /src/backend/optimizer/util/pathnode.c | |
parent | 2e68077b07cc597ef6bdfacffb5acbd17e179237 (diff) | |
download | postgresql-f47b33a19115f432ad80777db0d1350d23bb6cf5.tar.gz postgresql-f47b33a19115f432ad80777db0d1350d23bb6cf5.zip |
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
Diffstat (limited to 'src/backend/optimizer/util/pathnode.c')
-rw-r--r-- | src/backend/optimizer/util/pathnode.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index b8b1eae295e..54e042a8a59 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -1423,11 +1423,16 @@ create_merge_append_path(PlannerInfo *root, Cost input_total_cost; ListCell *l; + /* + * We don't currently support parameterized MergeAppend paths, as + * explained in the comments for generate_orderedappend_paths. + */ + Assert(bms_is_empty(rel->lateral_relids) && bms_is_empty(required_outer)); + pathnode->path.pathtype = T_MergeAppend; pathnode->path.parent = rel; pathnode->path.pathtarget = rel->reltarget; - pathnode->path.param_info = get_appendrel_parampathinfo(rel, - required_outer); + pathnode->path.param_info = NULL; pathnode->path.parallel_aware = false; pathnode->path.parallel_safe = rel->consider_parallel; pathnode->path.parallel_workers = 0; @@ -1453,6 +1458,9 @@ create_merge_append_path(PlannerInfo *root, { Path *subpath = (Path *) lfirst(l); + /* All child paths should be unparameterized */ + Assert(bms_is_empty(PATH_REQ_OUTER(subpath))); + pathnode->path.rows += subpath->rows; pathnode->path.parallel_safe = pathnode->path.parallel_safe && subpath->parallel_safe; @@ -1480,9 +1488,6 @@ create_merge_append_path(PlannerInfo *root, input_startup_cost += sort_path.startup_cost; input_total_cost += sort_path.total_cost; } - - /* All child paths must have same parameterization */ - Assert(bms_equal(PATH_REQ_OUTER(subpath), required_outer)); } /* |