Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eKPjs-0007pK-0M for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Nov 2017 14:22:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eKPjr-0004QB-IM for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Nov 2017 14:22:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eKPjr-0004Q1-74 for pgsql-hackers@lists.postgresql.org; Thu, 30 Nov 2017 14:22:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eKPjn-0002a8-TG for pgsql-hackers@postgresql.org; Thu, 30 Nov 2017 14:22:53 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vAUEMilw030572; Thu, 30 Nov 2017 09:22:44 -0500 From: Tom Lane To: Etsuro Fujita cc: Ashutosh Bapat , Robert Haas , Jeff Janes , David Steele , pgsql-hackers Subject: Re: [HACKERS] postgres_fdw bug in 9.6 In-reply-to: <5A1FFFD7.6080904@lab.ntt.co.jp> References: <22168.1504041271@sss.pgh.pa.us> <20170905044336.18925.22634.pgcf@coridan.postgresql.org> <07ed8f27-12cf-8403-d23b-f7d907de4a83@lab.ntt.co.jp> <7031.1507215420@sss.pgh.pa.us> <25877.1511886076@sss.pgh.pa.us> <27145.1511994722@sss.pgh.pa.us> <5A1FFFD7.6080904@lab.ntt.co.jp> Comments: In-reply-to Etsuro Fujita message dated "Thu, 30 Nov 2017 21:55:51 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <85223.1512051763.1@sss.pgh.pa.us> Date: Thu, 30 Nov 2017 09:22:43 -0500 Message-ID: <85224.1512051763@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Etsuro Fujita 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. 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. regards, tom lane