From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Jairo Graterón <jgrateron(at)gmail(dot)com> |
Cc: | Lista PostgreSQL <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | Re: Consulta lenta |
Date: | 2020-10-20 14:02:04 |
Message-ID: | 20201020140204.GA15297@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Jairo Graterón escribió:
> explain select max(id) from invoices where num_ruc='20524953189';
> QUERY PLAN
>
> -------------------------------------------------------------------------------------------------------------------
> Result (cost=474.18..474.19 rows=1 width=8)
> InitPlan 1 (returns $0)
> -> Limit (cost=0.57..474.18 rows=1 width=8)
> -> Index Scan Backward using invoices_pkey on ose_ticket
> (cost=0.57..8389569.35 rows=17714 width=8)
> Index Cond: (id IS NOT NULL)
> Filter: ((num_ruc)::text = '20524953189'::text)
> (6 rows)
>
> El campo num_ruc está indexado pero el motor decide que usa el índice del
> id y busca con filter el num_ruc
Muestra el \d de la tabla.
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin García | 2020-11-06 00:58:32 | actualizaciones |
Previous Message | Jairo Graterón | 2020-10-20 00:14:21 | Re: Consulta lenta |