Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eKOMu-0001XC-1v for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Nov 2017 12:55:08 +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 1eKOMt-0002nA-3r for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Nov 2017 12:55:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eKOMs-0002my-TE for pgsql-hackers@lists.postgresql.org; Thu, 30 Nov 2017 12:55:06 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eKOMl-0007pD-Dq for pgsql-hackers@postgresql.org; Thu, 30 Nov 2017 12:55:06 +0000 Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id vAUCsntL025597; Thu, 30 Nov 2017 21:54:49 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 15D5F60292; Thu, 30 Nov 2017 21:54:49 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 08F7A5F680; Thu, 30 Nov 2017 21:54:49 +0900 (JST) Received: from [IPv6:::1] (unknown [129.60.241.75]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id E17C84006E1; Thu, 30 Nov 2017 21:54:48 +0900 (JST) Message-ID: <5A1FFFD7.6080904@lab.ntt.co.jp> Date: Thu, 30 Nov 2017 21:55:51 +0900 From: Etsuro Fujita User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 Subject: Re: [HACKERS] postgres_fdw bug in 9.6 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> In-Reply-To: <27145.1511994722@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit To: Tom Lane Cc: Ashutosh Bapat , Robert Haas , Jeff Janes , David Steele , pgsql-hackers X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk (2017/11/30 7:32), Tom Lane wrote: > AFAICT, [1] just demonstrates that nobody had thought about the scenario > up to that point, not that the subsequently chosen solution was a good > one. In that example, > > LockRows (cost=100.00..101.18 rows=4 width=70) > Output: tab.a, tab.b, tab.ctid, foo.*, bar.* > -> Nested Loop (cost=100.00..101.14 rows=4 width=70) > Output: tab.a, tab.b, tab.ctid, foo.*, bar.* > Join Filter: (foo.a = tab.a) > -> Seq Scan on public.tab (cost=0.00..1.01 rows=1 width=14) > Output: tab.a, tab.b, tab.ctid > -> Foreign Scan (cost=100.00..100.08 rows=4 width=64) > Output: foo.*, foo.a, bar.*, bar.a > Relations: (public.foo) INNER JOIN (public.bar) > Remote SQL: SELECT l.a1, l.a2, r.a1, r.a2 FROM (SELECT ROW(l.a9), l.a9 FROM (SELECT a a9 FROM public.foo FOR UPDATE) l) l (a1, a2) INNER JOIN (SELECT ROW(r.a9), r.a9 FROM (SELECT a a9 FROM public.bar FOR UPDATE) r) r (a1, a2) ON ((l.a2 = r.a2)) > > 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? Best regards, Etsuro Fujita