Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ipPp6-0008Ci-RK for pgsql-general@arkaria.postgresql.org; Thu, 09 Jan 2020 04:53:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ipPp5-0001RW-IH for pgsql-general@arkaria.postgresql.org; Thu, 09 Jan 2020 04:53:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ipPp5-0001Q1-8L for pgsql-general@lists.postgresql.org; Thu, 09 Jan 2020 04:53:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ipPoy-0004pM-72 for pgsql-general@lists.postgresql.org; Thu, 09 Jan 2020 04:53:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 0094rJtc019346; Wed, 8 Jan 2020 23:53:19 -0500 From: Tom Lane To: shigeo Hirose cc: pgsql-general@lists.postgresql.org Subject: Re: How can I pushdown of functions used in targetlist with FDW ? In-reply-to: References: Comments: In-reply-to shigeo Hirose message dated "Thu, 09 Jan 2020 13:34:08 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19344.1578545599.1@sss.pgh.pa.us> Date: Wed, 08 Jan 2020 23:53:19 -0500 Message-ID: <19345.1578545599@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk shigeo Hirose 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. You can force matters by making a foreign table that points to a view on the remote side, where the view includes the function call as an output column. It wouldn't be perfectly transparent of course; you'd have to modify the local query to refer to that column rather than calling the function explicitly. regards, tom lane