Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2025-10-02T12:09:27Z
Lists: pgsql-hackers
Attachments
- v2-0001-Teach-UNION-planner-to-remove-dummy-inputs.patch (application/octet-stream) patch v2-0001
- v2-0002-Teach-planner-to-short-circuit-EXCEPT-INTERSECT-w.patch (application/octet-stream) patch v2-0002
On Thu, 2 Oct 2025 at 16:21, Tom Lane <tgl@sss.pgh.pa.us> wrote: > I'm wondering if it could be shortened a great deal by > handling left-input-dummy and EXCEPT-ALL-with-right-input-dummy > but leaving the EXCEPT-with-right-input-dummy case unimproved. Good idea. Less code and still get to keep the one that did well in the benchmark. See attached. I ended up splitting the patch in two. 0001 for UNION only, then 0002 for the INTERSECT and EXCEPT. David
Commits
-
Fix UNION planner estimate_num_groups with varno==0
- eaa159632d03 19 (unreleased) landed
-
Fix possible usage of incorrect UPPERREL_SETOP RelOptInfo
- fdda78e361f1 19 (unreleased) landed
-
Teach planner to short-circuit EXCEPT/INTERSECT with dummy inputs
- 9c9d41af4db7 19 (unreleased) landed
-
Fix incorrect targetlist in dummy UNIONs
- 928df067d1e6 19 (unreleased) landed
-
Teach UNION planner to remove dummy inputs
- 03d40e4b523b 19 (unreleased) landed