Re: [HACKERS] postgres_fdw bug in 9.6

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, David Steele <david(at)pgmasters(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] postgres_fdw bug in 9.6
Date: 2017-12-08 09:40:32
Message-ID: 5A2A5E10.1040604@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

(2017/11/30 23:22), Tom Lane wrote:
> Etsuro Fujita<fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> writes:
>> (2017/11/30 7:32), Tom Lane wrote:
>>> the output of the foreign join cannot change during EPQ, since the remote
>>> server already locked the rows before returning them. The only thing that
>>> can change is the output of the local scan on public.tab. Yes, we then
>>> need to re-verify that foo.a = tab.a ... but in this example, that's the
>>> responsibility of the NestLoop plan node, not the foreign join.
>
>> That's right, but is that true when the FDW uses late row locking?
>
> An FDW using late row locking would need to work harder, yes. But
> that's true at the scan level as well as the join level. We have
> already committed to using early locking in postgres_fdw, for the
> network-round-trip-cost reasons I mentioned before, and I can't see
> why we'd change that decision at the join level.

My concern is FDWs that support join pushdown in combination with late
row locking. I don't know whether such FDWs really exist, but if so, an
output of a foreign join computed from re-fetched tuples might change.

> Right now we've got the worst of both worlds, in that we're actually
> doing early row locking on the remote, but we're paying (some of) the
> code complexity costs required for late locking.

Because we have provided the late row locking API, I think we should pay
a certain degree of consideration for such FDWs.

Best regards,
Etsuro Fujita

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2017-12-08 09:52:38 Incorrect debug info printed in generate_partition_wise_join_paths
Previous Message Tels 2017-12-08 09:24:45 Re: [HACKERS] Parallel tuplesort (for parallel B-Tree index creation)