Re: Remove inner joins based on foreign keys

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ayoub Kazar <ayoub(dot)kazar(at)data-bene(dot)io>
Cc: 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 15:11:41
Message-ID: 1279528.1795619501@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ayoub Kazar <ayoub(dot)kazar(at)data-bene(dot)io> writes:
> 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."

I regret not having weighed in on this thread before, because I see
that a lot of effort has been spent already on a project that I don't
think should ever get committed. This proposal is as rickety and
overcomplicated as can be, adds costs all over the map, and despite
that it has enough restrictions on when the optimization can be used
to create serious doubt as to whether there'd be any significant
real-world usefulness. Even if you get all the bugs out I fear it'd
be a net negative for most users.

I think it'd be best to cut your losses and move on.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Sabino Mullane 2026-11-25 15:12:06 Re: [PATCH] pg_upgrade: add --initdb option to create the new cluster automatically
Previous Message vignesh C 2026-11-25 14:56:42 Re: Proposal: Conflict log history table for Logical Replication