Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cJ01x-0000T3-P2 for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Dec 2016 15:39:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cJ01w-0000gL-Qx for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Dec 2016 15:39:12 +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 1cJ00W-0007Xq-Vv for pgsql-hackers@postgresql.org; Mon, 19 Dec 2016 15:37:45 +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.84_2) (envelope-from ) id 1cJ00P-0008M6-Vt for pgsql-hackers@postgresql.org; Mon, 19 Dec 2016 15:37:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id uBJFbWpC010841; Mon, 19 Dec 2016 10:37:33 -0500 From: Tom Lane To: Etsuro Fujita cc: Ashutosh Bapat , Jeff Janes , Robert Haas , pgsql-hackers Subject: Re: postgres_fdw bug in 9.6 In-reply-to: <57825f66-9f11-0b0f-e4bf-e6608641c8e2@lab.ntt.co.jp> References: <6319.1481219450@sss.pgh.pa.us> <7784.1481221687@sss.pgh.pa.us> <13242.1481582736@sss.pgh.pa.us> <31740.1481819950@sss.pgh.pa.us> <12565.1481904788@sss.pgh.pa.us> <57825f66-9f11-0b0f-e4bf-e6608641c8e2@lab.ntt.co.jp> Comments: In-reply-to Etsuro Fujita message dated "Mon, 19 Dec 2016 12:36:14 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10839.1482161852.1@sss.pgh.pa.us> Date: Mon, 19 Dec 2016 10:37:32 -0500 Message-ID: <10840.1482161852@sss.pgh.pa.us> X-Pg-Spam-Score: -5.0 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Etsuro Fujita writes: > On 2016/12/17 1:13, Tom Lane wrote: >> So I think the rule could be >> "When first asked to produce a path for a given foreign joinrel, collect >> the cheapest paths for its left and right inputs, and make a nestloop path >> (or hashjoin path, if full join) from those, using the join quals needed >> for the current input relation pair. > Seems reasonable. >> Use this as the fdw_outerpath for >> all foreign paths made for the joinrel." > I'm not sure that would work well for foreign joins with sort orders. > Consider a merge join, whose left input is a 2-way foreign join with a > sort order that implements a full join and whose right input is a sorted > local table scan. If the EPQ subplan for the foreign join wouldn't > produce the right sort order, the merge join might break during EPQ > rechecks (note that in this case the EPQ subplan for the foreign join > might produce more than a single row during an EPQ recheck). How so? We only recheck one row at a time, therefore it can be claimed to have any sort order you care about. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers