Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aenPA-0008W7-Nb for pgsql-hackers@arkaria.postgresql.org; Sat, 12 Mar 2016 17:32:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aenPA-0002D6-31 for pgsql-hackers@arkaria.postgresql.org; Sat, 12 Mar 2016 17:32:44 +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) (envelope-from ) id 1aenP7-0002CI-R3 for pgsql-hackers@postgresql.org; Sat, 12 Mar 2016 17:32:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aenP0-0002mS-Bl for pgsql-hackers@postgresql.org; Sat, 12 Mar 2016 17:32:41 +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 u2CHWVKK029064; Sat, 12 Mar 2016 12:32:31 -0500 From: Tom Lane To: Robert Haas cc: David Rowley , Tomas Vondra , Simon Riggs , PostgreSQL-development Subject: Re: Performance improvement for joins where outer side is unique In-reply-to: References: <20150320.121140.148610378.horiguchi.kyotaro@lab.ntt.co.jp> <27152324.eFKJb4Khb5@dinodell> <8608754a32d1325c2f83ba8b1df71585@xs4all.nl> <55DA1F9F.5040204@2ndquadrant.com> <5085.1440375543@sss.pgh.pa.us> <8907.1440383377@sss.pgh.pa.us> <56718B15.6060507@2ndquadrant.com> <5671FF0D.2010403@2ndquadrant.com> <56A25A72.2090505@2ndquadrant.com> <24304.145748278! 0@sss.pgh.pa.us> <13653.1457731978@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Sat, 12 Mar 2016 12:16:50 -0500" Date: Sat, 12 Mar 2016 12:32:31 -0500 Message-ID: <29063.1457803951@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) 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 Robert Haas writes: > The new join pushdown code in postgres_fdw does not grok SEMI and ANTI > joins because there is no straightforward way of reducing those back > to SQL. They can originate in multiple ways and not all of those can > be represented easily. I think it would be nice to do something to > fix this. For example, if a LEFT join WHERE outer_column IS NULL > turns into an ANTI join, it would be nice if that were marked in some > way so that postgres_fdw could conveniently emit it in the original > form. > Maybe the people who have been working on that patch just haven't been > creative enough in thinking about how to solve this problem, but it > makes me greet the idea of more join types that don't map directly > back to SQL with somewhat mixed feelings. I can't summon a whole lot of sympathy for that objection. These cases won't arise with postgres_fdw as it stands because we'd never be able to prove uniqueness on a foreign table. When and if someone tries to improve that, we can think about how the whole thing ought to map to FDWs. Having said that, your point does add a bit of weight to David's suggestion of inventing two new join-type codes rather than overloading JOIN_SEMI. I'd still be a bit inclined to display JOIN_INNER_UNIQUE or whatever we call it as a "Semi" join in EXPLAIN, though, just to minimize the amount of newness there. 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