Re: pass-through queries to foreign servers

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: David Gudeman <dave(dot)gudeman(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Fetter <david(at)fetter(dot)org>, Postgres <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pass-through queries to foreign servers
Date: 2013-08-05 19:02:11
Message-ID: CAFj8pRAo=VPvAJvLF3_uCULUmum1WwvYtb_kC1gUFcuUzuB5qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

2013/8/5 David Gudeman <dave(dot)gudeman(at)gmail(dot)com>:
> For those who don't want to go to the link to see what I'm talking
> about with query rewrites, I thought I'd give a brief description.
> Foreign data wrappers currently do all of their work in the planning
> phase but I claim that isn't the right place to optimize foreign
> queries with aggregates and GROUP BY because optimizing those things
> would involve collapsing multiple plan node back into a single node
> for a foreign call. I propose to do these optimizations as query
> rewrites instead. So for example suppose t is a foreign table on the
> foreign server named fs. Then the query
>
> SELECT count(*) FROM t
>
> is rewritten to
>
> SELECT count FROM fs('select count(*) from t') fs(count bigint)
>
> where ts() is the pass-through query function for the server fs. To
> implement this optimization as a query rewrite, all of the elements of
> the result have to be real source-language constructs so the
> pass-through query has to be available in Postgresql SQL.
>

why you introduce new API? There is still dblink.

Regards

Pavel

> My current implementation of this uses a plugin that hooks into
> planner_hook, but I'm hoping that I can get some support for adding
> the query rewriting as callback functions for the FDW system.
>
> Regards,
> David Gudeman
> http://unobtainabol.blogspot.com
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2013-08-05 19:02:24 Re: Disabling ALTER SYSTEM SET WAS: Re: ALTER SYSTEM SET command to change postgresql.conf parameters
Previous Message David Gudeman 2013-08-05 18:55:51 Re: pass-through queries to foreign servers