pg.ddx.io  pgsql-es-ayuda@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@alvh.no-ip.org>
To: Guillermo E. Villanueva <guillermovil@gmail.com>
Cc: Horacio Miranda <hmiranda@gmail.com>
Cc: Jairo Graterón <jgrateron@gmail.com>
Cc: pgsql-es-ayuda <pgsql-es-ayuda@postgresql.org>
Subject: Re: plan de ejecución
Date: Wed, 5 Feb 2025 13:13:47 +0100
Message-ID: <202502051213.6jo6oofnt24m@alvherre.pgsql> (raw)
In-Reply-To: <CANm+PCD0msujcJTCe4CscC-_zzPgc6x=WEbfs_dqtDXcyKALuQ@mail.gmail.com>

Guillermo E. Villanueva escribió:
> Jaja si engaño a pg y cambio la condición
> and companies.fulldate::text >= '2025-01-31 09:30' and companies.fulldate::
> text < '2025-02-04 09:30'
> 
> ya no usa el índice secundario, usa el índice de la PK y resuelve la query
> en menos de un segundo , lo tengo resuelto así pero me quedo con la duda de
> porque el planificador lo hace mal de la otra manera (para mi)

Hmm, es raro.  ¿Has visto el tamaño de los índices?  ¿Qué tienes en
effective_cache_size y shared_buffers?

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/





view thread (18+ messages)  latest in thread

Message-ID: <202502051213.6jo6oofnt24m@alvherre.pgsql>
Permalink:  ../202502051213.6jo6oofnt24m@alvherre.pgsql/
Also on:    postgresql.org/message-id/202502051213.6jo6oofnt24m@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-es-ayuda@postgresql.org
  Cc: alvherre@alvh.no-ip.org, guillermovil@gmail.com, hmiranda@gmail.com, jgrateron@gmail.com
  Subject: Re: plan de ejecución
  In-Reply-To: <202502051213.6jo6oofnt24m@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox