Re: BUG #18904: INTERSECT with an impossible where should eliminate both from the query plan

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, "jh.lai@qq.com" <jh.lai@qq.com>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2025-04-29T11:57:57Z
Lists: pgsql-bugs
On Mon, 28 Apr 2025 at 06:02, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Anyway, as David said, this is not a bug.  If it's something you
> really want to see happen, try writing a patch yourself.

This is already somewhat better in v18 thanks to [1].
generate_nonunion_paths() already has some code to put the smallest
child on the left, and the recent changes in nodeSetOp.c means very
little work will be done when the left side is empty.

David

[1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=276279295