Re: Foreign join pushdown vs EvalPlanQual

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: kaigai(at)ak(dot)jp(dot)nec(dot)com, robertmhaas(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org, shigeru(dot)hanada(at)gmail(dot)com
Subject: Re: Foreign join pushdown vs EvalPlanQual
Date: 2015-10-01 11:02:11
Message-ID: 560D12B3.6070607@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015/10/01 19:02, Kyotaro HORIGUCHI wrote:
> At Thu, 1 Oct 2015 17:50:25 +0900, Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> wrote in <560CF3D1(dot)9060305(at)lab(dot)ntt(dot)co(dot)jp>
>>>> From: pgsql-hackers-owner(at)postgresql(dot)org
>>>> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Robert Haas

>>>> So, if we wanted to fix this in a way that preserves the spirit of
>>>> what's there now, it seems to me that we'd want the FDW to return
>>>> something that's like a whole row reference, but represents the output
>>>> of the foreign join rather than some underlying base table. And then
>>>> get the EPQ machinery to have the evaluation of the ForeignScan for
>>>> the join, when it happens in an EPQ context, to return that tuple.
>>>> But I don't really have a good idea how to do that.

>> So, I'd like to investigate another approach that preserves the
>> applicability of late row locking to the join pushdown case as well as
>> the spirit of what's there now. The basic idea is (1) add a new
>> callback routine RefetchForeignJoinRow that refetches one foreign-join
>> tuple from the foreign server, after locking remote tuples for the
>> component foreign tables if required,

> It would be the case that at least one of the component relations
> of a foreign join is other than ROW_MARK_COPY, which is not
> possible so far on postgres_fdw.

Yes. To be exact, it's possible for the component relations to have
rowmark methods other than ROW_MARK_COPY using GetForeignRowMarkType, in
principle, but the server crashes ...

> For the case that some of the
> component relations are other than ROW_MARK_COPY, we might should
> call RefetchForeignRow for such relations and construct joined
> row involving ROW_MARK_COPY relations.

You are saying that we should construct the joined row using an
alternative local join execution plan?

> Indeed we could consider some logic for the case, it is obvious
> that the case now we should focus on is a "foreign join" scan
> with all underlying foreign scans are ROW_MARK_COPY, I
> think. "foreign join" scan with ROW_MARK_COPY looks to be
> promising (for me) and in future it would be able to coexist with
> refetch mechanism maybe in your mind from this point of
> view... Maybe:p

I agree that the approach "foreign-join scan with ROW_MARK_COPY" would
be promising.

Best regards,
Etsuro Fujita

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikolay Shaplov 2015-10-01 11:13:37 Re: pageinspect patch, for showing tuple data
Previous Message Andres Freund 2015-10-01 10:53:22 Re: ON CONFLICT issues around whole row vars,