Re: Why not do distinct before SetOp

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: ma lz <ma100@hotmail.com>, "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>
Date: 2024-11-05T23:38:00Z
Lists: pgsql-general
On Wed, 6 Nov 2024 at 12:09, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Of course, I might be overestimating the performance benefit we'd get.
> But I'm tempted to give it a try.

I'm glad. I'm curious to see if you're right about the projection
overhead of the flags. If you're right, it seems like a not too
difficult optimisation to get in.

I like the idea as it also gets rid of the flag cruft from
prepunion.c, which saves having to add flags conditionally if
INTERCEPT/EXCEPT were ever made to use joins.

David