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 1hGl8p-0001Ij-02 for pgsql-admin@arkaria.postgresql.org; Wed, 17 Apr 2019 14:02:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hGl8n-0003kn-Ka for pgsql-admin@arkaria.postgresql.org; Wed, 17 Apr 2019 14:02:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGl8n-0003kg-8U for pgsql-admin@lists.postgresql.org; Wed, 17 Apr 2019 14:02:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGl8h-0003gX-83 for pgsql-admin@postgresql.org; Wed, 17 Apr 2019 14:02:20 +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 x3HE2Aru028625; Wed, 17 Apr 2019 10:02:10 -0400 From: Tom Lane To: Thomas Kellerer cc: pgsql-admin@postgresql.org Subject: Re: Performance killed with FDW when using CAST. In-reply-to: References: Comments: In-reply-to Thomas Kellerer message dated "Wed, 17 Apr 2019 08:23:02 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <28622.1555509730.1@sss.pgh.pa.us> Date: Wed, 17 Apr 2019 10:02:10 -0400 Message-ID: <28623.1555509730@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thomas Kellerer writes: > Laurenz Albe schrieb am 17.04.2019 um 07:03: >> After debugging into this, it seems that the hstore operator -> cannot >> be pushed down because of collation problems. > Do you happen to know if the JSONB operator -> (or ->>) can be pushed down? A bit of experimentation says that jsonb -> integer can be pushed down, but not any of the variants involving a text fieldname or result. Presumably this is because of the heuristic that says not to push down a collation that didn't arise from the remote column. jsonb -> text isn't really collation-sensitive, of course, but postgres_fdw has no good way to know that, since the core code (outside of that operator itself) doesn't know it either. The assumption is that any function with at least one input of a collatable type is collation-sensitive. Here you're getting a default collation from the text literal, and postgres_fdw doesn't want to assume that the remote end would choose the same collation. regards, tom lane