Re: Custom Scan APIs (Re: Custom Plan node)

From: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
To: Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>
Cc: KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>, Jim Mlodgenski <jimmy76(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PgHacker <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: Custom Scan APIs (Re: Custom Plan node)
Date: 2014-01-14 14:19:45
Message-ID: CADyhKSXSp9UeOR95SV_441UprDOqZO3SZyrUk4-uTAi+Kz66fA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

The attached patches are the ones rebased to the latest git tree, but
no functional
changes from the previous revision on the commit-fest:Nov.
Hanada-san volunteered to review the series of patches, including the
portion for
postgres_fdw, then marked it as "ready for committer" on the last commit fest.
So, I hope someone of committer also volunteer to review the patches for final
checking.

* Part-1 - CustomScan APIs
This patch provides a set of interfaces to interact query-optimizer
and -executor
for extensions. The new add_scan_path_hook or add_join_path_hook allows to
offer alternative ways to scan a particular relation or to join a
particular relations.
Then, once the alternative ways are chosen by the optimizer,
associated callbacks
shall be kicked from the executor. In this case, extension has responsibility to
return a slot that hold a tuple (or empty for end of scan) being
scanned from the
underlying relation.

* Part-2 - contrib/ctidscan
This patch provides a simple example implementation of CustomScan API.
It enables to skip pages when inequality operators are given on ctid system
columns. That is, at least, better than sequential full-scan, so it usually wins
to SeqScan, but Index-scan is much better.

* Part-3 - remote join implementation
This patch provides an example to replace a join by a custom scan node that
runs on a result set of remote join query, on top of existing postgres_fdw
extension. The idea is, a result set of remote query looks like a relation but
intangible, thus, it is feasible to replace a local join by a scan on the result
set of a query executed on the remote host, if both of the relation to be joined
belongs to the identical foreign server.
This patch gives postgres_fdw a capability to run a join on the remote host.

Thanks,

2013/12/16 Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>:
> KaiGai-san,
>
> 2013/12/16 KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>:
>> (2013/12/16 14:15), Shigeru Hanada wrote:
>>> (1) ctidscan
>>> Is session_preload_libraries available to enable the feature, like
>>> shared_*** and local_***? According to my trial it works fine like
>>> two similar GUCs.
>>>
>> It shall be available; nothing different from the two parameters that
>> we have supported for long time. Sorry, I missed the new feature to
>> mention about.
>
> Check.
>
>>> (2) postgres_fdw
>>> JOIN push--down is a killer application of Custom Scan Provider
>>> feature, so I think it's good to mention it in the "Remote Query
>>> Optimization" section.
>>>
>> I added an explanation about remote join execution on the section.
>> Probably, it help users understand why Custom Scan node is here
>> instead of Join node. Thanks for your suggestion.
>
> Check.
>
> I think that these patches are enough considered to mark as "Ready for
> Committer".
>
> Regards,
> --
> Shigeru HANADA

--
KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>

Attachment Content-Type Size
pgsql-v9.4-custom-scan.part-1.v5.patch application/octet-stream 62.8 KB
pgsql-v9.4-custom-scan.part-2.v5.patch application/octet-stream 53.8 KB
pgsql-v9.4-custom-scan.part-3.v5.patch application/octet-stream 66.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Claudio Freire 2014-01-14 14:34:32 Re: Optimize kernel readahead using buffer access strategy
Previous Message Oskari Saarenmaa 2014-01-14 13:55:30 Re: [PATCH] Filter error log statements by sqlstate