| From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
|---|---|
| To: | Ilia Evdokimov <ilidock95(at)gmail(dot)com> |
| Cc: | Antonin Houska <ah(at)cybertec(dot)at>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andy Fan <zhihuifan1213(at)163(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com> |
| Subject: | Re: Tracking per-RelOptInfo uniqueness during planning |
| Date: | 2026-12-06 01:07:59 |
| Message-ID: | CAMbWs4_isgij6Oji0PQhndNCihFfcTszpLP7VUCNzpfvJGdVfQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Nov 24, 2026 at 5:16 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> Here is v6. v5 only had the first three patches. v6 adds the to-do
> items mentioned upthread, as 0004 to 0008. 0001 to 0003 are the same
> as in v5 except for some comment changes.
Here is v7 of the patchset. Compared to v6:
1. Fixed a correctness issue with outer joins in 0004. v6 treated the
right-hand ECs of a left join's clauses as fixed from the start,
rather than only once the join's left-hand relations are fixed, which
could wrongly prove a join relation distinct. This bug was found by
Claude Opus 5.5.
2. Rebased over 9774003d9, so I don't need to hack around self-join
elimination anymore.
3. Added tests for some code paths that the existing tests did not
cover, and made various cosmetic changes.
For anyone who wants to review the design, 0001 is the place to look.
It introduces UniqueKeys, which are kept for base relations only, and
works out whether a join relation is distinct from the UniqueKeys of
its base relations.
The logic and code in 0001-0003 are simple and straightforward, so I'm
quite confident in them and may push them in the near future, unless
anyone objects. 0004 and 0005 are where I have spent most of my time,
and where I would most appreciate reviews and testing. 0006-0008
extend the same approach to child relations, partially aggregated
relations and subqueries. They build on 0004 and 0005, so I'd like to
get those reviewed first.
- Richard
| Attachment | Content-Type | Size |
|---|---|---|
| v7-0001-Introduce-UniqueKeys-to-detect-unique-inner-sides.patch | application/octet-stream | 38.4 KB |
| v7-0002-Teach-UniqueKeys-about-NULLs-to-skip-DISTINCT-and.patch | application/octet-stream | 43.9 KB |
| v7-0003-Skip-DISTINCT-steps-over-grouped-or-windowed-inpu.patch | application/octet-stream | 17.2 KB |
| v7-0004-Teach-UniqueKeys-about-outer-joins.patch | application/octet-stream | 46.3 KB |
| v7-0005-Teach-UniqueKeys-about-semijoins-and-antijoins.patch | application/octet-stream | 19.8 KB |
| v7-0006-Detect-unique-inner-sides-of-joins-for-child-rela.patch | application/octet-stream | 13.9 KB |
| v7-0007-Detect-unique-inner-sides-of-joins-for-partially-.patch | application/octet-stream | 44.5 KB |
| v7-0008-Build-UniqueKeys-for-subquery-relations.patch | application/octet-stream | 22.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tatsuo Ishii | 2026-12-06 01:15:57 | Re: Row pattern recognition |
| Previous Message | Tomas Vondra | 2026-12-06 00:55:18 | Re: extremely slow planner when DISTINCT clause holds more columns |