Re: Memoize ANTI and SEMI JOIN inner

From: Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Andrei Lepikhov <lepihov(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Memoize ANTI and SEMI JOIN inner
Date: 2025-03-31 03:21:43
Message-ID: b63acc7a-60bc-4595-81a9-fc6de22e367f@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 31.03.2025 06:04, David Rowley wrote:
> On Mon, 31 Mar 2025 at 15:33, Alena Rybakina<a(dot)rybakina(at)postgrespro(dot)ru> wrote:
>> I believe it's worth asserting that both inner_unique and single_mode are not true at the same time — just as a safety check.
> add_paths_to_joinrel() just chooses not to populate inner_unique for
> SEMI and ANTI joins because, as of today's master, it's pretty
> pointless to determine that because the executor will short-circuit
> and skip to the next outer tuple for those join types anyway. I don't
> follow why having both these flags set would cause trouble. It seems
> perfectly legitimate that add_paths_to_joinrel() could choose to set
> the inner_unique flag for these join types, and if it did, the Assert
> you're proposing would fail for no good reason.
>
I tend to agree with you that someone might set this flag to true for
these join types in the future.

However, is it necessary to check that extra->inner_unique must be false
for SEMI/ANTI joins here, or am I missing something? It looks a little
confusing at this point.

if(!extra->inner_unique&& (jointype== JOIN_SEMI|| jointype== JOIN_ANTI))

    single_mode= true;

--

Regards,
Alena Rybakina
Postgres Professional

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2025-03-31 03:33:03 Re: Memoize ANTI and SEMI JOIN inner
Previous Message vignesh C 2025-03-31 03:04:32 Re: Commit fest 2025-03