diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2023-03-16 18:13:35 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2023-03-16 18:13:45 -0400 |
commit | 9bfd2822b3201f6b0de1e87305b11ee3885b36d9 (patch) | |
tree | 6a77ebc0607221c4c884c7fa42a14c168179571c /src/backend/optimizer/util/pathnode.c | |
parent | 0dc40196f27531ab30bbbc516df9894edc276d6e (diff) | |
download | postgresql-9bfd2822b3201f6b0de1e87305b11ee3885b36d9.tar.gz postgresql-9bfd2822b3201f6b0de1e87305b11ee3885b36d9.zip |
Enable use of Memoize atop an Append that came from UNION ALL.
create_append_path() would only apply get_baserel_parampathinfo
when the path is for a partitioned table, but it's also potentially
useful for paths for UNION ALL appendrels. Specifically, that
supports building a Memoize path atop this one.
While we're in the vicinity, delete some dead code in
create_merge_append_plan(): there's no need for it to support
parameterized MergeAppend paths, and it doesn't look like that
is going to change anytime soon. It'll be easy enough to undo
this when/if it becomes useful.
Richard Guo
Discussion: https://postgr.es/m/CAMbWs4_ABSu4PWG2rE1q10tJugEXHWgru3U8dAgkoFvgrb6aEA@mail.gmail.com
Diffstat (limited to 'src/backend/optimizer/util/pathnode.c')
-rw-r--r-- | src/backend/optimizer/util/pathnode.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index e8e06397a9c..65a191ebfda 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -1256,15 +1256,17 @@ create_append_path(PlannerInfo *root, pathnode->path.pathtarget = rel->reltarget; /* - * When generating an Append path for a partitioned table, there may be - * parameterized quals that are useful for run-time pruning. Hence, - * compute path.param_info the same way as for any other baserel, so that - * such quals will be available for make_partition_pruneinfo(). (This - * would not work right for a non-baserel, ie a scan on a non-leaf child - * partition, and it's not necessary anyway in that case. Must skip it if - * we don't have "root", too.) + * If this is for a baserel (not a join or non-leaf partition), we prefer + * to apply get_baserel_parampathinfo to construct a full ParamPathInfo + * for the path. This supports building a Memoize path atop this path, + * and if this is a partitioned table the info may be useful for run-time + * pruning (cf make_partition_pruneinfo()). + * + * However, if we don't have "root" then that won't work and we fall back + * on the simpler get_appendrel_parampathinfo. There's no point in doing + * the more expensive thing for a dummy path, either. */ - if (root && rel->reloptkind == RELOPT_BASEREL && IS_PARTITIONED_REL(rel)) + if (rel->reloptkind == RELOPT_BASEREL && root && subpaths != NIL) pathnode->path.param_info = get_baserel_parampathinfo(root, rel, required_outer); |