| From: | Ayoub Kazar <ayoub(dot)kazar(at)data-bene(dot)io> |
|---|---|
| To: | Richard Guo <guofenglinux(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Remove inner joins based on foreign keys |
| Date: | 2026-11-25 14:32:04 |
| Message-ID: | 4543dbcf-a319-415c-9462-2b3402c49e18@data-bene.io |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On 23/06/2026 08:54, Richard Guo wrote:
> On Mon, Jun 22, 2026 at 7:42 PM Tender Wang <tndrwang(at)gmail(dot)com> wrote:
>> Richard Guo <guofenglinux(at)gmail(dot)com> 于2026年5月26日周二 05:01写道:
>>> (Attached v5 is the split version of v4, plus addressing Alex's two
>>> comments. 0002 is still the lock-based predicate from v4, posted as
>>> the concrete reference for option (B); it can be swapped for whichever
>>> approach the gap-handling discussion settles on.)
>> (The patches need to be rebased due to commit 9a60f295bcb18)
> Right. Here is the rebase.
>
> - Richard
I've rebased the patches on top of master, 2ebf25e7d70 actually made
things relatively
easier.
Here's what i think about the different solutions:
Since all solutions (except for option D (close the gap), which is a
much bigger fish really) still need to consider prepared statements
forcing custom plans, the current approach is okay but i would say that
subsequent SELECTs after DML are pretty common, it would be sad to limit
ourselves there...
This takes us to option C:
Quoting you: "Add a "captured during a gap window" bit to SnapshotData,
populated in
CopySnapshot when AfterTriggerPendingOnAnyRel() returns true at
capture time. inner_join_is_removable() and choose_custom_plan()
consult the bit on the active snapshot."
This is much better, i think documenting it would be enough, and maybe
this flag would help other users in the future if someone wanted to
handle DEFERRABLE or anything else in a better way.
If there's opposition to touching SnapshotData, there are other ways
like keeping a list of snapshots that were registered when triggers were
pending and checking against it, but this is way worse than the above...
I prefer C.
Attached is the rebase (v7), i kept it split as you did.
Regards,
Ayoub Kazar
| Attachment | Content-Type | Size |
|---|---|---|
| v7-0001-Remove-inner-joins-based-on-foreign-keys.patch | text/x-patch | 54.5 KB |
| v7-0002-Suppress-FK-based-inner-join-removal-during-the-trigger-gap.patch | text/x-patch | 14.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ayush Tiwari | 2026-11-25 14:39:49 | Re: pg_commit_ts pages can be written before WAL is flushed |
| Previous Message | Daniel Gustafsson | 2026-11-25 14:04:43 | Re: Small cleanup of leftover pre-1.1.0 OpenSSL code |