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: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: postgres_fdw bug in 9.6
Date: Fri, 16 Dec 2016 21:50:45 +0900
Message-ID: <f2684b07-b2e2-155b-b1e8-e141e89458b5@lab.ntt.co.jp> (raw)
In-Reply-To: <c4d6d586-80cd-4328-7d92-0ea7a6b380d2@lab.ntt.co.jp>
References: <CAMkU=1y2G8VOVBHv3iXU2TMAj7-RyBFFW1uhkr5sm9LQ2=X35g@mail.gmail.com>
	<6319.1481219450@sss.pgh.pa.us>
	<CA+TgmoZNpXHBp8yADNS7HST9OJAx4_MoZ5ckbxoFhSYo84nY2w@mail.gmail.com>
	<7784.1481221687@sss.pgh.pa.us>
	<CAMkU=1zEAryzjEa-njBkV2+uXXVHHk6u2V2eS1MT+zP7s=vj1Q@mail.gmail.com>
	<13242.1481582736@sss.pgh.pa.us>
	<CAFjFpRfYETZLiKERpxCeAN1MsiJypsyNd6x9FQ7OWjY=_TGK2Q@mail.gmail.com>
	<b06b113e-73a1-fa5e-91b6-28bda2551a08@lab.ntt.co.jp>
	<31740.1481819950@sss.pgh.pa.us>
	<c4d6d586-80cd-4328-7d92-0ea7a6b380d2@lab.ntt.co.jp>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 2016/12/16 11:25, Etsuro Fujita wrote:
> As I said upthread, an alternative I am thinking is (1) to create an
> equivalent nestloop join path using inner/outer paths of a foreign join
> path, except when that join path implements a full join, in which case a
> merge/hash join path is used, (2) store it in fdw_outerpath as-is, and
> (3) during an EPQ recheck, apply postgresRecheckForeignScan to the outer
> subplan created from the fdw_outerpath as-is.  What do you think about
> that?

Let me explain about #1 and #2 a bit more.  What I have in mind is:

* modify postgresGetForeignPaths so that a simple foreign table scan 
path is stored into the base relation's PgFdwRelationInfo.
* modify postgresGetForeignJoinPaths so that
     (a) a local join path for a 2-way foreign join is created using 
simple foreign table scan paths stored in the base relations' 
PgFdwRelationInfos, and stored into the join relation's PgFdwRelationInfo.
     (b) a local join path for a 3-way foreign join, whose left input is 
a 2-way foreign join, is created using a local join path stored in the 
left input join relation's PgFdwRelationInfo and a simple foreign table 
scan path stored into the right input base relation's PgFdwRelationInfo.
     (c) Likewise for higher level foreign joins.
     (d) local join paths created are passed to create_foreignscan_path 
and stored into the fdw_outerpaths of the resulting ForeignPahts.

I think that that would need special handling for foreign joins with 
sort orders; add an explicit sort to the local join paths, if needed.

I am thinking to provide a helper function that creates a local join 
path for (a), (b), and (c).

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: <f2684b07-b2e2-155b-b1e8-e141e89458b5@lab.ntt.co.jp>
Permalink:  ../f2684b07-b2e2-155b-b1e8-e141e89458b5@lab.ntt.co.jp/
Also on:    postgresql.org/message-id/f2684b07-b2e2-155b-b1e8-e141e89458b5@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, tgl@sss.pgh.pa.us, ashutosh.bapat@enterprisedb.com, jeff.janes@gmail.com, robertmhaas@gmail.com
  Subject: Re: postgres_fdw bug in 9.6
  In-Reply-To: <f2684b07-b2e2-155b-b1e8-e141e89458b5@lab.ntt.co.jp>
  References: <CAMkU=1y2G8VOVBHv3iXU2TMAj7-RyBFFW1uhkr5sm9LQ2=X35g@mail.gmail.com> <6319.1481219450@sss.pgh.pa.us> <CA+TgmoZNpXHBp8yADNS7HST9OJAx4_MoZ5ckbxoFhSYo84nY2w@mail.gmail.com> <7784.1481221687@sss.pgh.pa.us> <CAMkU=1zEAryzjEa-njBkV2+uXXVHHk6u2V2eS1MT+zP7s=vj1Q@mail.gmail.com> <13242.1481582736@sss.pgh.pa.us> <CAFjFpRfYETZLiKERpxCeAN1MsiJypsyNd6x9FQ7OWjY=_TGK2Q@mail.gmail.com> <b06b113e-73a1-fa5e-91b6-28bda2551a08@lab.ntt.co.jp> <31740.1481819950@sss.pgh.pa.us> <c4d6d586-80cd-4328-7d92-0ea7a6b380d2@lab.ntt.co.jp> <f2684b07-b2e2-155b-b1e8-e141e89458b5@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