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 1hNfvi-0002J7-RQ for pgsql-performance@arkaria.postgresql.org; Mon, 06 May 2019 15:53:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hNfvh-0004u2-Dw for pgsql-performance@arkaria.postgresql.org; Mon, 06 May 2019 15:53:25 +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 1hNfvh-0004tv-4W for pgsql-performance@lists.postgresql.org; Mon, 06 May 2019 15:53:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNfve-0000rE-VG for pgsql-performance@lists.postgresql.org; Mon, 06 May 2019 15:53:24 +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 x46FrJ7G016479; Mon, 6 May 2019 11:53:19 -0400 From: Tom Lane To: Jeff Janes cc: Vitaly Baranovsky , pgsql-performance@lists.postgresql.org Subject: Re: PostgreSQL optimizer use seq scan instead of pkey index only scan (in queries with postgres_fdw) In-reply-to: References: Comments: In-reply-to Jeff Janes message dated "Mon, 06 May 2019 11:32:03 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16477.1557157999.1@sss.pgh.pa.us> Date: Mon, 06 May 2019 11:53:19 -0400 Message-ID: <16478.1557157999@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Jeff Janes writes: > It works the way you want in version 12, which is currently under > development and should be released in 5 months or so. Even in older versions, the OP would get a significantly smarter plan after setting use_remote_estimate = on. I think the core issue here is that we won't generate remote parameterized paths without that: /* * If we're not using remote estimates, stop here. We have no way to * estimate whether any join clauses would be worth sending across, so * don't bother building parameterized paths. */ if (!fpinfo->use_remote_estimate) return; regards, tom lane