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: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(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>
Subject: Re: Add semi-join pushdown to postgres_fdw
Date: 2023-11-27 00:49:25
Message-ID: CAPpHfdtYndP0+P4YjJrNAgX6X6xVL6z4n0L_u3P=se+Xt0VksA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Alexander!

On Tue, Oct 31, 2023 at 1:07 PM Alexander Pyhalov
<a(dot)pyhalov(at)postgrespro(dot)ru> wrote:
> There are several cases when we can't push down semi-join in current
> patch.
>
> 1) When target list has attributes from inner relation, which are
> equivalent to some attributes of outer
> relation, we fail to notice this.
>
> 2) When we examine A join B and decide that we can't push it down, this
> decision is final - we state it in fdw_private of joinrel,
> and so if we consider joining these relations in another order, we don't
> reconsider.
> This means that if later examine B join A, we don't try to push it down.
> As semi-join can be executed as JOIN_UNIQUE_INNER or JOIN_UNIQUE_OUTER,
> this can be a problem - we look at some of these paths and remember that
> we can't push down such join.

Thank you for the revision.

I've revised the patch myself. I've replaced StringInfo with
additional conds into a list of strings as I proposed before. I think
the code became much clearer. Also, it gets rid of some unnecessary
allocations.

I think the code itself is not in bad shape. But patch lacks some
high-level description of semi-joins processing as well as comments on
each manipulation with additional conds. Could you please add this?

------
Regards,
Alexander Korotkov

Attachment Content-Type Size
0001-postgres_fdw-add-support-for-deparsing-semi-joins-v6.patch application/octet-stream 51.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2023-11-27 01:04:38 Re: Assert failure on 'list_member_ptr(rel->joininfo, restrictinfo)'
Previous Message Alexander Korotkov 2023-11-27 00:08:26 Re: [HACKERS] make async slave to wait for lsn to be replayed