Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHZ5K-0006tD-NQ for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Dec 2016 16:40:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cHZ5K-0008H7-5W for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Dec 2016 16:40:46 +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 1cHZ3u-0006dt-MF for pgsql-hackers@postgresql.org; Thu, 15 Dec 2016 16:39:18 +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 1cHZ3s-0001Pv-9g for pgsql-hackers@postgresql.org; Thu, 15 Dec 2016 16:39:17 +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 uBFGdAJ2031741; Thu, 15 Dec 2016 11:39:10 -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: References: <6319.1481219450@sss.pgh.pa.us> <7784.1481221687@sss.pgh.pa.us> <13242.1481582736@sss.pgh.pa.us> Comments: In-reply-to Etsuro Fujita message dated "Thu, 15 Dec 2016 18:40:03 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31739.1481819950.1@sss.pgh.pa.us> Date: Thu, 15 Dec 2016 11:39:10 -0500 Message-ID: <31740.1481819950@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/13 23:13, Ashutosh Bapat wrote: >> On Tue, Dec 13, 2016 at 4:15 AM, Tom Lane wrote: >>> One way that we could make things better is to rely on the knowledge >>> that EPQ isn't asked to evaluate joins for more than one row per input >>> relation, and therefore using merge or hash join technology is really >>> overkill. We could make a tree of simple nestloop joins, which aren't >>> going to care about sort order, if we could identify the correct join >>> clauses to apply. >> I am not able to understand how this strategy of applying all join >> clauses on top of cross product would work if there are OUTER joins >> involved. Wouldn't nullable sides change the result? > I'm not able to understand that, either. Yeah, you'd have to reproduce the outer join structure if any. >> A possible short-term fix may be this: instead of picking any random >> path to stick into fdw_outerpath, we choose a path which covers the >> pathkeys of ForeignPath. > Seems reasonable. No, because GetExistingLocalJoinPath is called once per relation not once per path. Even if we were willing to eat the overhead of calling it once per path, we'd have to give up considering foreign paths with sort orders that there wasn't any cheap way to produce locally. 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