From: Stephen Frost <sfrost@snowman.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: shigeo Hirose <shigeo.hirose@toshiba.co.jp>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: How can I pushdown of functions used in targetlist with FDW ?
Date: Thu, 9 Jan 2020 12:09:00 -0500
Message-ID: <20200109170900.GU3195@tamriel.snowman.net> (raw)
In-Reply-To: <19345.1578545599@sss.pgh.pa.us>
References: <f10e87b5-1340-bfeb-9009-ba4adb3eed65@swc.toshiba.co.jp>
<19345.1578545599@sss.pgh.pa.us>
Greetings,
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> shigeo Hirose <shigeo.hirose@toshiba.co.jp> writes:
> > How can I pushdown of functions used in targetlist with FDW ?
>
> There is, AFAIK, no provision for that. There's not a lot of
> reason to consider adding it either, because there's no reason
> to suppose that the remote node can run such a function any
> faster than the local node. So the difficulty and risk of
> determining/assuming that f(x) on the local node is the same
> as f(x) on the remote node doesn't seem like it'd be repaid.
Well, for starters, isn't there something in the SQL/MED spec about
this..?
Next, we already do this for aggregates.
Also, I don't think I agree with this particular position- it's entirely
possible that the remote server is much less loaded/busy than the local
one and therefore it'd be beneficial, overall, to run that function on
the remote system and not the local one. The function might even have
side-effects or use other objects in the system to run. The function
may also return a much smaller result than pulling back the raw data (of
course, the opposite could also possibly be true).
I guess my gut feeling is that, in general, we should push down as much
of the query as possible, as we do for aggregates and joins and
conditionals. I appreciate that there's some complications here when it
comes to figuring out if it's possible/reasonable to push down something
like, say, a volatile function that's locally defined and known to exist
on the remote. Haven't got a particular idea how to address that
offhand but that doesn't change my feelings that we should have a way to
do this generally and that it would actually be useful to have.
Thanks,
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
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-general@postgresql.org
Cc: sfrost@snowman.net, tgl@sss.pgh.pa.us, shigeo.hirose@toshiba.co.jp
Subject: Re: How can I pushdown of functions used in targetlist with FDW ?
In-Reply-To: <20200109170900.GU3195@tamriel.snowman.net>
References: <f10e87b5-1340-bfeb-9009-ba4adb3eed65@swc.toshiba.co.jp> <19345.1578545599@sss.pgh.pa.us> <20200109170900.GU3195@tamriel.snowman.net>
* 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