Memoize ANTI and SEMI JOIN inner

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Memoize ANTI and SEMI JOIN inner
Date: 2025-03-06 13:08:59
Message-ID: 60bf8d26-7c7e-4915-b544-afdb9020011d@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

In case of NestLoop with parameterised inner semi-join for each outer
tuple requires only a single tuple from its inner relation to produce a
result. It seems that the same principle applies to an anti-join. This
approach could effectively allow the Memoize node to enhance the
performance of pulled-up EXISTS and NOT EXISTS sublinks.

In attachment see a sketch of the feature. Since we are using single_row
mode, adapting this method to cache semi-join inner results should not
be extremely complex. However, I am unsure about potential corner cases
and would appreciate any feedback or criticisms regarding this approach.

--
regards, Andrei Lepikhov

Attachment Content-Type Size
v0-0001-Memoise-the-inner-of-SEMI-and-ANTI-join.patch text/plain 6.1 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2025-03-06 13:12:25 Re: History doc page clarification on naming
Previous Message Euler Taveira 2025-03-06 13:05:56 Re: Separate GUC for replication origins