aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeRecursiveunion.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2024-12-19 17:07:14 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2024-12-19 17:07:14 -0500
commitf0b900086a370e45f730138d55da4f260d24809c (patch)
treefc49d65b5e54d64c5975243ac532122d3658b219 /src/backend/executor/nodeRecursiveunion.c
parent8d96f57d5cc79c0c51050bb707c19bf07d2895eb (diff)
downloadpostgresql-f0b900086a370e45f730138d55da4f260d24809c.tar.gz
postgresql-f0b900086a370e45f730138d55da4f260d24809c.zip
Use ExecGetCommonSlotOps infrastructure in more places.
Append, MergeAppend, and RecursiveUnion can all use the support functions added in commit 276279295. The first two can report a fixed result slot type if all their children return the same fixed slot type. That does nothing for the append step itself, but might allow optimizations in the parent plan node. RecursiveUnion can optimize tuple hash table operations in the same way as SetOp now does. Patch by me; thanks to Richard Guo and David Rowley for review. Discussion: https://postgr.es/m/1850138.1731549611@sss.pgh.pa.us
Diffstat (limited to 'src/backend/executor/nodeRecursiveunion.c')
-rw-r--r--src/backend/executor/nodeRecursiveunion.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/executor/nodeRecursiveunion.c b/src/backend/executor/nodeRecursiveunion.c
index 39be4cdc3b1..b577b72b50c 100644
--- a/src/backend/executor/nodeRecursiveunion.c
+++ b/src/backend/executor/nodeRecursiveunion.c
@@ -37,10 +37,14 @@ build_hash_table(RecursiveUnionState *rustate)
Assert(node->numCols > 0);
Assert(node->numGroups > 0);
- /* XXX is it worth working a bit harder to determine the inputOps here? */
+ /*
+ * If both child plans deliver the same fixed tuple slot type, we can tell
+ * BuildTupleHashTableExt to expect that slot type as input. Otherwise,
+ * we'll pass NULL denoting that any slot type is possible.
+ */
rustate->hashtable = BuildTupleHashTableExt(&rustate->ps,
desc,
- NULL,
+ ExecGetCommonChildSlotOps(&rustate->ps),
node->numCols,
node->dupColIdx,
rustate->eqfuncoids,