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 1jRiX9-0005PY-CN for pgsql-performance@arkaria.postgresql.org; Thu, 23 Apr 2020 20:33:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jRiX7-0007DG-7k for pgsql-performance@arkaria.postgresql.org; Thu, 23 Apr 2020 20:33:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRiX7-0007D6-0K for pgsql-performance@lists.postgresql.org; Thu, 23 Apr 2020 20:33:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRiX3-0006Uk-OG for pgsql-performance@lists.postgresql.org; Thu, 23 Apr 2020 20:33:15 +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 03NKX7D5012001; Thu, 23 Apr 2020 16:33:07 -0400 From: Tom Lane To: Stephen Frost cc: "David G. Johnston" , Thomas Kellerer , "pgsql-performance@lists.postgresql.org" Subject: Re: PostgreSQL does not choose my indexes well In-reply-to: <20200423200143.GK13712@tamriel.snowman.net> References: <35dc90d6-e0c2-13b8-3184-e3db5d854a78@gmail.com> <1bb37a19-77f6-8c49-073e-ed6251c98583@gmx.net> <4315.1587655779@sss.pgh.pa.us> <20200423171858.GE13712@tamriel.snowman.net> <18681.1587664601@sss.pgh.pa.us> <20200423200143.GK13712@tamriel.snowman.net> Comments: In-reply-to Stephen Frost message dated "Thu, 23 Apr 2020 16:01:43 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11999.1587673987.1@sss.pgh.pa.us> Date: Thu, 23 Apr 2020 16:33:07 -0400 Message-ID: <12000.1587673987@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Stephen Frost writes: > I'm pretty suspicious that they've made some odd planner configuration > changes or something along those lines to end up with the plan they got, > or there's some reason we don't think we can use the partial index. Yeah, the latter is definitely a possibility. I find the apparently unnecessary cast in the partial-index predicate to be suspicious --- maybe that's blocking matching to the WHERE clause? In principle the useless cast should have gotten thrown away, but maybe what we were shown isn't quite exactly the real DDL. regards, tom lane