From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
---|---|
To: | "sunw(dot)fnst" <936739278(at)qq(dot)com> |
Cc: | pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: The issue of incorrect width estimation in UNION queries |
Date: | 2025-09-25 21:42:19 |
Message-ID: | CAApHDvraBCBhQF=oambO0hS+4oL9YiEH_i-_W5hNm=XSRO+L0Q@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Wed, 24 Sept 2025 at 22:47, David Rowley <dgrowleyml(at)gmail(dot)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
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Improve-width-estimates-for-set-operations.patch | application/octet-stream | 5.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Hushcha | 2025-09-26 05:53:09 | Issue with PostgreSQL 18.0 Docker image volume mount (/var/lib/postgresql/data symlink) |
Previous Message | Peter Geoghegan | 2025-09-25 19:46:44 | Re: Postgres: Queries are too slow after upgrading to PG17 from PG15 |