Re: PostgreSQL does not choose my indexes well

From: Arcadio Ortega Reinoso <arcadio(dot)ortega(at)gmail(dot)com>
To: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL does not choose my indexes well
Date: 2020-04-23 21:01:36
Message-ID: f79d1a82-af70-116e-717f-29f308190572@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

El 23/4/20 a las 22:45, Tom Lane escribió:
> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> 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
>
>
Actually

CREATE DOMAIN cod_pk AS bigint;

create table public.tabla
(
    cod_tabla cod_pk not null,
    tabla varchar(31) not null,
    constraint pk_tabla primary key (cod_tabla)
);

Do you think is important?

Thank you very much to all

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message singh400@gmail.com 2020-04-24 16:33:25 Re: Duplicate WHERE condition changes performance and plan
Previous Message Tom Lane 2020-04-23 20:45:42 Re: PostgreSQL does not choose my indexes well