Re: Add semi-join pushdown to postgres_fdw

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>
Cc: Robins Tharakan <tharakan(at)gmail(dot)com>, "Fujii(dot)Yuki(at)df(dot)MitsubishiElectric(dot)co(dot)jp" <Fujii(dot)Yuki(at)df(dot)mitsubishielectric(dot)co(dot)jp>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, tndrwang(at)gmail(dot)com
Subject: Re: Add semi-join pushdown to postgres_fdw
Date: 2025-03-24 01:21:36
Message-ID: CAPpHfdu0+Zyvy6acCeW2YKaaTbH=PggyNJbrKMu2__KbEGVEFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Alexander!

On Tue, Mar 18, 2025 at 6:04 PM Alexander Pyhalov
<a(dot)pyhalov(at)postgrespro(dot)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 Content-Type Size
v2-0001-Avoid-pulling-up-restrict-infos-from-subqueries.patch application/octet-stream 6.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2025-03-24 01:27:30 Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints
Previous Message Thomas Munro 2025-03-24 01:11:24 Re: AIO v2.5