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 1jmPDb-0007QC-51 for pgsql-performance@arkaria.postgresql.org; Fri, 19 Jun 2020 22:10:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jmPDa-0001bd-1z for pgsql-performance@arkaria.postgresql.org; Fri, 19 Jun 2020 22:10:38 +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 1jmPDZ-0001bV-Ql for pgsql-performance@lists.postgresql.org; Fri, 19 Jun 2020 22:10:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jmPDX-0008DR-PA for pgsql-performance@lists.postgresql.org; Fri, 19 Jun 2020 22:10:36 +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 05JMAYlF1759985; Fri, 19 Jun 2020 18:10:34 -0400 From: Tom Lane To: Kenneth Marshall cc: pgsql-performance@lists.postgresql.org Subject: Re: PostgreSQL 12.3 slow index scan chosen In-reply-to: <20200619212338.GM1497@aart.rice.edu> References: <20200619194914.GI1497@aart.rice.edu> <1755412.1592597470@sss.pgh.pa.us> <20200619204950.GL1497@aart.rice.edu> <1757512.1592600355@sss.pgh.pa.us> <20200619212338.GM1497@aart.rice.edu> Comments: In-reply-to Kenneth Marshall message dated "Fri, 19 Jun 2020 16:23:38 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1759983.1592604634.1@sss.pgh.pa.us> Date: Fri, 19 Jun 2020 18:10:34 -0400 Message-ID: <1759984.1592604634@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Kenneth Marshall writes: > On Fri, Jun 19, 2020 at 04:59:15PM -0400, Tom Lane wrote: >> What's the actual maximum value of objectcustomfieldvalues.objectid, >> and how does that compare to the endpoint value in the pg_stats >> histogram for that column? If you've got one outlier in the table, >> it might get missed by ANALYZE. > max(objectcustomfieldvalues.objectid) = 28108423 and here is the > histogram for that column: ... 3304313,3693956,27667772} Hmm, does seem like you have some outlier keys. Are any of the keys in the column you're trying to join to larger than 27667772? regards, tom lane