Re: Custom/Foreign-Join-APIs (Re: [v9.5] Custom Plan API)

From: Shigeru HANADA <shigeru(dot)hanada(at)gmail(dot)com>
To: Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Thom Brown <thom(at)linux(dot)com>, "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Custom/Foreign-Join-APIs (Re: [v9.5] Custom Plan API)
Date: 2015-03-24 10:35:58
Message-ID: B381E803-5E15-4AD1-8694-E0706A8596D0@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2015/03/23 9:12、Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com> のメール:

> Sorry for my response late. It was not easy to code during business trip.
>
> The attached patch adds a hook for FDW/CSP to replace entire join-subtree
> by a foreign/custom-scan, according to the discussion upthread.
>
> GetForeignJoinPaths handler of FDW is simplified as follows:
> typedef void (*GetForeignJoinPaths_function) (PlannerInfo *root,
> RelOptInfo *joinrel);

It’s not a critical issue but I’d like to propose to rename add_joinrel_extra_paths() to add_extra_paths_to_joinrel(), because the latter would make it more clear that it does extra work in addition to add_paths_to_joinrel().

> It takes PlannerInfo and RelOptInfo of the join-relation to be replaced
> if available. RelOptInfo contains 'relids' bitmap, so FDW driver will be
> able to know the relations to be involved and construct a remote join query.
> However, it is not obvious with RelOptInfo to know how relations are joined.
>
> The function below will help implement FDW driver that support remote join.
>
> List *
> get_joinrel_broken_down(PlannerInfo *root, RelOptInfo *joinrel,
> SpecialJoinInfo **p_sjinfo)
>
> It returns a list of RelOptInfo to be involved in the relations join that
> is represented with 'joinrel', and also set a SpecialJoinInfo on the third
> argument if not inner join.
> In case of inner join, it returns multiple (more than or equal to 2)
> relations to be inner-joined. Elsewhere, it returns two relations and
> a valid SpecialJoinInfo.

As far as I tested, it works fine for SEMI and ANTI.
# I want dump function of BitmapSet for debugging, as Node has nodeToString()...

> At this moment, I'm not 100% certain about its logic. Especially, I didn't
> test SEMI- and ANTI- join cases yet.
> However, time is money - I want people to check overall design first, rather
> than detailed debugging. Please tell me if I misunderstood the logic to break
> down join relations.

With applying your patch, regression tests of “updatable view” failed. regression.diff contains some errors like this:
! ERROR: could not find RelOptInfo for given relids

Could you check that?


Shigeru HANADA

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-03-24 11:35:28 Re: Error with index on unlogged table
Previous Message Tomas Vondra 2015-03-24 10:24:21 Re: WIP: multivariate statistics / proof of concept