Re: PostgreSQL does not choose my indexes well - Mailing list pgsql-performance

From David G. Johnston
Subject Re: PostgreSQL does not choose my indexes well
Date
Msg-id CAKFQuwbNs3Avhz0vXU3uabymEoxWsXH9bhCiMWDSkhuPt5-mHg@mail.gmail.com
Whole thread Raw
In response to Re: PostgreSQL does not choose my indexes well  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: PostgreSQL does not choose my indexes well
List pgsql-performance
On Thu, Apr 23, 2020 at 1:33 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
I find the apparently
unnecessary cast in the partial-index predicate to be suspicious ---
maybe that's blocking matching to the WHERE clause?

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)

Since the index condition ended up cast to bigint the OP probably wrote the predicate to match.

David J.

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: PostgreSQL does not choose my indexes well
Next
From: Tom Lane
Date:
Subject: Re: PostgreSQL does not choose my indexes well