Re: Add semi-join pushdown to postgres_fdw - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: Add semi-join pushdown to postgres_fdw
Date
Msg-id CAPpHfdu0+Zyvy6acCeW2YKaaTbH=PggyNJbrKMu2__KbEGVEFA@mail.gmail.com
Whole thread Raw
In response to Re: Add semi-join pushdown to postgres_fdw  (Alexander Pyhalov <a.pyhalov@postgrespro.ru>)
Responses Re: Add semi-join pushdown to postgres_fdw
List pgsql-hackers
Hi, Alexander!

On Tue, Mar 18, 2025 at 6:04 PM Alexander Pyhalov
<a.pyhalov@postgrespro.ru> wrote:
> This shouldn't. When semi-join is found below left/right join, it's
> deparsed as subquery.
> Interesting enough, this mechanics (deparsing as subquery) is used
> 1) for semi-joins under left/right join,
> 2) for full outer joins when inner or outer part has some remote_conds.
>
> The issue here is that after subquery is deparsed, we don't consider if
> its target attributes are available to the upper level
> join . As for semi-join itself, all conditions are still deparsed on
> left/right join boundary, they are just not propagated further.
> This shouldn't be a problem, as they are evaluated in subquery. As for
> left/right join without semi-join beneath it - its behavior is not
> affected
> (as hidden_subquery_rels is empty).

Thank you for the explanation.  But I have another question.  Aren't
the checks you've proposed too strict?  hidden_subquery_rels are
propagated all the way to the join tree.  So, pulling conditions would
be disables all the way to the join tree too.  Is it enough to just
disable pulling conditions directly from semi-joins, then their
further pulls will be disabled automatically?  See the attached patch.
It also contains other (mostly cosmetic improvements).

------
Regards,
Alexander Korotkov
Supabase

Attachment

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: AIO v2.5
Next
From: jian he
Date:
Subject: Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints