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 1jRijJ-0005si-27 for pgsql-performance@arkaria.postgresql.org; Thu, 23 Apr 2020 20:45:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jRijH-0005f1-UI for pgsql-performance@arkaria.postgresql.org; Thu, 23 Apr 2020 20:45:51 +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 1jRijH-0005do-N9 for pgsql-performance@lists.postgresql.org; Thu, 23 Apr 2020 20:45:51 +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 1jRijF-0006bn-PC for pgsql-performance@lists.postgresql.org; Thu, 23 Apr 2020 20:45:50 +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 03NKjge6012522; Thu, 23 Apr 2020 16:45:42 -0400 From: Tom Lane To: "David G. Johnston" cc: Stephen Frost , Thomas Kellerer , "pgsql-performance@lists.postgresql.org" Subject: Re: PostgreSQL does not choose my indexes well In-reply-to: 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> <12000.1587673987@sss.pgh.pa.us> Comments: In-reply-to "David G. Johnston" message dated "Thu, 23 Apr 2020 13:36:15 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <12520.1587674742.1@sss.pgh.pa.us> Date: Thu, 23 Apr 2020 16:45:42 -0400 Message-ID: <12521.1587674742@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "David G. Johnston" writes: > I noticed that too...I suspect its related to the ANALYZE result: > Index Scan using idx_tabla_entidad on entidad (cost=0.56..51121.41 > rows=1405216 width=20) (actual time=0.037..242.609 rows=1409985 loops=1) > Index Cond: ((cod_tabla)::bigint = 4) Yeah, that *strongly* suggests that cod_tabla isn't really bigint. I'm wondering about domains, for instance. regards, tom lane