Re: postgres_fdw join pushdown (was Re: Custom/Foreign-Join-APIs)

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Thom Brown <thom(at)linux(dot)com>, "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>
Subject: Re: postgres_fdw join pushdown (was Re: Custom/Foreign-Join-APIs)
Date: 2016-02-05 08:17:47
Message-ID: 56B45AAB.1040001@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2016/02/04 21:42, Ashutosh Bapat wrote:

> * Is it safe to replace outerjoinpath with its fdw_outerpath the
> following way? I think that if the join relation represented by
> outerjoinpath has local conditions that can't be executed remotely,
> we have to keep outerjoinpath in the path tree; we will otherwise
> fail to execute the local conditions. No?
>
> + /*
> + * If either inner or outer path is a
> ForeignPath corresponding to
> + * a pushed down join, replace it with the
> fdw_outerpath, so that we
> + * maintain path for EPQ checks built
> entirely of local join
> + * strategies.
> + */
> + if (IsA(joinpath->outerjoinpath, ForeignPath))
> + {
> + ForeignPath *foreign_path;
> + foreign_path = (ForeignPath
> *)joinpath->outerjoinpath;
> + if
> (foreign_path->path.parent->reloptkind == RELOPT_JOINREL)
> + joinpath->outerjoinpath =
> foreign_path->fdw_outerpath;
> + }

> all the conditions (local and remote) should be part of fdw_outerpath as
> well, since that's the alternate local path, which should produce (when
> converted to the plan) the same result as the foreign path.
> fdw_outerpath should be a local path set when paths for
> outerjoinpath->parent was being created. Am I missing something?

I assumed by mistake that only the remote conditions were evaluated in a
plan created from each fdw_outerpath. Sorry for that. I think that is
a good idea!

Btw, IIUC, I think the patch fails to adjust the targetlist of the top
plan created that way, to output the fdw_scan_tlist, as discussed in [1]
(ie, I think the attached patch is needed, which is created on top of
your patch pg_fdw_join_v8.patch).

Best regards,
Etsuro Fujita

[1]
http://www.postgresql.org/message-id/CA+TgmobA4MSKgquicgt5CkbpQJ-TmpqEfHt_wy49ndwa91Wkpw@mail.gmail.com

Attachment Content-Type Size
fdw-outer-plan-tlist.patch application/x-patch 473 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Moser 2016-02-05 08:32:55 Re: Development with Eclipse - Wrong error messages in IDE
Previous Message pokurev 2016-02-05 08:15:58 Re: [PROPOSAL] VACUUM Progress Checker.