Re: Status of FDW pushdowns

From: David Fetter <david(at)fetter(dot)org>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>, Denis Lussier <denis(dot)lussier(at)openscg(dot)com>
Subject: Re: Status of FDW pushdowns
Date: 2013-12-03 04:26:34
Message-ID: 20131203042634.GA28207@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 03, 2013 at 11:15:36AM +0800, Craig Ringer wrote:
> On 11/28/2013 03:24 AM, David Fetter wrote:
> > WITH, or SRF, or whatever, the point is that we need to be able to
> > specify what we're sending--probably single opaque strings delimited
> > just as we do other strings--and what we might get back--errors only,
> > rows, [sets of] refcursors are the ones I can think of offhand.
>
> So, you're thinking of something like:
>
> WITH FOREIGN somecte AS $$... foreign query ...$$
> SELECT ...
> FROM somecte;

I was picturing something a little more like an SRF which would take
one opaque string, the remote command, some descriptor, perhaps an
enum, of what if anything might come back. Long ago, I implemented a
similar thing in DBI-Link. It was called

remote_exec_dbh(data_source_id integer, query text, returns_rows bool)

That covered only some of the cases I've come up with since. My
current idea is something more like

remote_execute(
data_source_id integer, /* This corresponds to a "handle" in SQL/MED-speak */
query text,
returns enum(
'void',
'some_type',
'setof some_type',
'setof record',
'refcursor',
'setof refcursor'
)
)

This could appear in a FROM or WITH clause. There might also be some
aliasing and/or syntactic sugar along the lines of remote_execute_void(),
remote_execute_rows(), etc. Given the possibility of cooperation with
the planner and executor, we might want to extend some attributes like
sortedness where applicable.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2013-12-03 04:26:49 Re: UNNEST with multiple args, and TABLE with multiple funcs
Previous Message Tom Dunstan 2013-12-03 03:17:11 Re: Proposed feature: Selective Foreign Keys