On Wed, 24 Sept 2025 at 22:47, David Rowley <dgrowleyml@gmail.com> wrote:
> The attached patch is against master. I
> need to spend a bit longer on this as generate_nonunion_paths() might
> need the same treatment. I've just run out of time for tonight.
Here's an updated patch which includes adjusting the width estimate
for generate_nonunion_paths() too.
I gave a bit of thought to how that should work for EXCEPT and
INTERSECT and concluded that for EXCEPT, we should take the width
estimate for the left-hand child, as no rows from the right-child will
be used. For INTERSECT, I couldn't think of anything better than
taking the weighted average of both children, the same as UNION. Of
course, only the rows which exist in both will make the final result,
but I don't see any way to do anything smart with a single width
estimate for each child.
David