Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kN0Mg-0006eS-7y for pgsql-performance@arkaria.postgresql.org; Mon, 28 Sep 2020 21:07:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kN0Me-0007QT-Vo for pgsql-performance@arkaria.postgresql.org; Mon, 28 Sep 2020 21:07:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kN0Me-0007QM-OP for pgsql-performance@lists.postgresql.org; Mon, 28 Sep 2020 21:07:16 +0000 Received: from [66.207.139.130] (helo=sss.pgh.pa.us) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kN0Mc-00023Y-Mq for pgsql-performance@lists.postgresql.org; Mon, 28 Sep 2020 21:07:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 08SL6p57408273; Mon, 28 Sep 2020 17:06:51 -0400 From: Tom Lane To: Timothy Garnett cc: pgsql-performance@lists.postgresql.org Subject: Re: Is it possible to specify minimum number of rows planner should consider? In-reply-to: References: Comments: In-reply-to Timothy Garnett message dated "Mon, 28 Sep 2020 16:12:37 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <408271.1601327211.1@sss.pgh.pa.us> Date: Mon, 28 Sep 2020 17:06:51 -0400 Message-ID: <408272.1601327211@sss.pgh.pa.us> X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.207.139.130 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Timothy Garnett writes: > Is there some way to tell the planner that unless it's guaranteed by a > constraint or some such it shouldn't guess that the selectivity of a > filter/anti-join is 1 row (e.g. minimum to consider is 2 rows unless it's > guaranteed to be 1 row) or somehow otherwise make it more conservative > around the worst case possibilities. There's been some discussion in that area, but it's a hard problem to solve in general, and especially so if you'd like to not break a ton of queries that work nicely today. regards, tom lane