pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
To: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: postgres_fdw bug in 9.6
Date: Wed, 11 Jan 2017 19:00:52 +0900
Message-ID: <61da5589-bd01-e2d4-797a-286429aded0a@lab.ntt.co.jp> (raw)
In-Reply-To: <CAFjFpRfHwvx+4rGXG+a+ZNhULy2gSEdvGLEPH5uZk97HE3cd4w@mail.gmail.com>
References: <CAMkU=1y2G8VOVBHv3iXU2TMAj7-RyBFFW1uhkr5sm9LQ2=X35g@mail.gmail.com>
	<12565.1481904788@sss.pgh.pa.us>
	<57825f66-9f11-0b0f-e4bf-e6608641c8e2@lab.ntt.co.jp>
	<10840.1482161852@sss.pgh.pa.us>
	<2ba137af-6c79-4179-72ad-10d32432fbde@lab.ntt.co.jp>
	<CAFjFpRd9oZEkur9aOrMh2Toxq4NYuUSw2kB9S+O=uvZ4xcR=Sw@mail.gmail.com>
	<396aac47-68e1-3e2e-2918-5a4ba65b6be5@lab.ntt.co.jp>
	<CAFjFpRcQDfT6p23JJXrHN=w6enhVR42Ksz6coaVZL8Tba3OPhg@mail.gmail.com>
	<3653f5f1-9247-76ab-03c4-327d2ccea01b@lab.ntt.co.jp>
	<CAFjFpRf2hmbuUa5q1Yo3A9jA3L9ezSCA=vN+ZPGWRp9+Za2R5A@mail.gmail.com>
	<98cc218e-a5e1-37ad-ad57-4e52b5c933a2@lab.ntt.co.jp>
	<CAFjFpRek1+1QXBiWNqeWw1cWyXBNH4rSWFuVZ-dHn_cT-ZH+QQ@mail.gmail.com>
	<f721652b-a9af-9a3b-6ba4-8720953eba3c@lab.ntt.co.jp>
	<fa9c8cdb-ee60-36bd-6cda-4172899e79b7@lab.ntt.co.jp>
	<CAFjFpRccHHQbfzbWZfo=SuC8sjcqukMRjNpx7tw7th2v-Ghmjw@mail.gmail.com>
	<ce7d8b72-c286-52d1-4a8a-57dba26c2494@lab.ntt.co.jp>
	<CAFjFpRfHwvx+4rGXG+a+ZNhULy2gSEdvGLEPH5uZk97HE3cd4w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 2017/01/11 17:51, Ashutosh Bapat wrote:
> On Wed, Jan 11, 2017 at 1:15 PM, Etsuro Fujita
> <fujita.etsuro@lab.ntt.co.jp> wrote:
>> On 2017/01/11 13:40, Ashutosh Bapat wrote:
>>> CreateLocalJoinPath tries to construct a nestloop path for the given
>>> join relation because it wants to avoid merge/hash join paths which
>>> require expensive setup not required for EPQ. But it chooses cheap
>>> paths for joining relations which may not be nestloop paths. So,
>>> effectively it could happen that the whole alternate local plan would
>>> be filled with hash/merge joins except the uppermost join.

>> In many cases the cheapest-total-cost outer and inner paths for a higher
>> foreign-join relation would be foreign join paths, which would have nestloop
>> paths as their fdw_outerpaths if not full joins.  So by redirection, the
>> plan tree for EPQ would be mostly constructed by nestloop joins.  No?

> It's not guaranteed that we will always have foreign join paths there.
> We have seen this in Jeff's example, which started this thread. We
> don't know in what all cases we have a tree entirely consisting of
> (cheapest) foreign join paths.

Right, but local-join plans need not be efficient since no base table 
will return more than one row, as stated in the documentation.  (I think 
efficient plans without complicating the code would be better, though.)

>>> Or it can
>>> have foreign paths in there, which will need redirection. That's not
>>> very good.

>> Maybe I'm missing something, but redirection isn't a problem.

> Peformance wise it is, correctness-wise it is not. Why do we want to
> incur a hop, when we can avoid it.

ISTM that's solving a problem that hasn't been proven to be a problem.

>>> 2. Fix existing code by applying patch from [1]

>> As I said before, that might be fine for 9.6, but I don't think it's a good
>> idea to search the pathlist because once we support parameterized foreign
>> join paths, which is on my TODOs, we would have to traverse through the
>> possibly-lengthy pathlist to find a local-join path, as mentioned in [3].

> I don't agree that pathlists will be long enough to make this a
> non-attractive solution. For parameterized foreign join paths, with
> the approach that this patch takes, we will require to search in two
> such pathlists, inner and outer.

Sorry, I don't understand this part.

Best regards,
Etsuro Fujita




-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (128+ messages)  latest in thread

Message-ID: <61da5589-bd01-e2d4-797a-286429aded0a@lab.ntt.co.jp>
Permalink:  ../61da5589-bd01-e2d4-797a-286429aded0a@lab.ntt.co.jp/
Also on:    postgresql.org/message-id/61da5589-bd01-e2d4-797a-286429aded0a@lab.ntt.co.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: fujita.etsuro@lab.ntt.co.jp, ashutosh.bapat@enterprisedb.com, jeff.janes@gmail.com, tgl@sss.pgh.pa.us, robertmhaas@gmail.com
  Subject: Re: postgres_fdw bug in 9.6
  In-Reply-To: <61da5589-bd01-e2d4-797a-286429aded0a@lab.ntt.co.jp>
  References: <CAMkU=1y2G8VOVBHv3iXU2TMAj7-RyBFFW1uhkr5sm9LQ2=X35g@mail.gmail.com> <10840.1482161852@sss.pgh.pa.us> <2ba137af-6c79-4179-72ad-10d32432fbde@lab.ntt.co.jp> <CAFjFpRd9oZEkur9aOrMh2Toxq4NYuUSw2kB9S+O=uvZ4xcR=Sw@mail.gmail.com> <396aac47-68e1-3e2e-2918-5a4ba65b6be5@lab.ntt.co.jp> <CAFjFpRcQDfT6p23JJXrHN=w6enhVR42Ksz6coaVZL8Tba3OPhg@mail.gmail.com> <3653f5f1-9247-76ab-03c4-327d2ccea01b@lab.ntt.co.jp> <CAFjFpRf2hmbuUa5q1Yo3A9jA3L9ezSCA=vN+ZPGWRp9+Za2R5A@mail.gmail.com> <98cc218e-a5e1-37ad-ad57-4e52b5c933a2@lab.ntt.co.jp> <CAFjFpRek1+1QXBiWNqeWw1cWyXBNH4rSWFuVZ-dHn_cT-ZH+QQ@mail.gmail.com> <f721652b-a9af-9a3b-6ba4-8720953eba3c@lab.ntt.co.jp> <fa9c8cdb-ee60-36bd-6cda-4172899e79b7@lab.ntt.co.jp> <CAFjFpRccHHQbfzbWZfo=SuC8sjcqukMRjNpx7tw7th2v-Ghmjw@mail.gmail.com> <ce7d8b72-c286-52d1-4a8a-57dba26c2494@lab.ntt.co.jp> <CAFjFpRfHwvx+4rGXG+a+ZNhULy2gSEdvGLEPH5uZk97HE3cd4w@mail.gmail.com> <61da5589-bd01-e2d4-797a-286429aded0a@lab.ntt.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox