Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs - Mailing list pgsql-hackers

From David Rowley
Subject Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs
Date
Msg-id CAApHDvpk88w3MrzgZShROjQw3NPK54YKr_hOi0++0QKGwTq+-g@mail.gmail.com
Whole thread Raw
In response to Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs
Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Arseniy Mukhin
Date:
Subject: Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue
Next
From: Greg Burd
Date:
Subject: Re: [PATCH] Add tests for Bitmapset