Re: Converting SetOp to read its two inputs separately
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Richard Guo <guofenglinux@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2024-12-19T06:33:20Z
Lists: pgsql-hackers
On Thu, 19 Dec 2024 at 15:44, Tom Lane <tgl@sss.pgh.pa.us> wrote: > > With David's recent fixes to allow telling BuildTupleHashTableExt > what input slot type to expect, it's possible to remove the per-row > slot type conversions I was doing before. So here's an updated > patchset with that done. > > The common_result_slot_type() function I wrote here perhaps > should be made generally available, but I didn't do that yet. I think it would be good to make this generic as it can be at least used in nodeRecursiveunion.c and nodeAppend.c. For the Append usage, I wonder if it's worth making the function accept an array of PlanStates rather than just two of them. Then, either add a helper function that allocates and assigns the outer and inner side to a stack-allocated two-element array, or just do that part in nodeSetOp.c and nodeRecursiveunion.c and pass that to the array-accepting function. Review: 0001: + /* Left group is first, has no right matches */ Should the comma be an "or"? 0002: Should this adjust the following nodeSetOp.c comment: * In SETOP_SORTED mode, each input has been sorted according to all the * grouping columns (ie, all the non-junk attributes). The SetOp node This implies that there can be junk columns. 0003: Looks fine. The only thing that I paused to think about was your decision to double disable hashing when !enable_hashagg and the results are bigger than get_hash_memory_limit(). I think have you have makes sense there. 0004: Looks fine. I see no reason to delay you pushing this. 0005: Looks good. David
Commits
-
Get rid of old version of BuildTupleHashTable().
- e0a2721f7c16 18.0 landed
-
Use ExecGetCommonSlotOps infrastructure in more places.
- f0b900086a37 18.0 landed
-
Improve planner's handling of SetOp plans.
- 8d96f57d5cc7 18.0 landed
-
Convert SetOp to read its inputs as outerPlan and innerPlan.
- 27627929528e 18.0 landed
-
Fix typo in header comment for set_operation_ordered_results_useful
- b6612aedc53a 18.0 landed
-
Allow planner to use Merge Append to efficiently implement UNION
- 66c0185a3d14 17.0 cited