Re: The query plan get all columns but I'm using only one column.

2020-04-25 Thread Michael Lewis
The example is nonsensical so I expect it is too contrived to be useful for analyzing the actual problem. Additionally, the total query time is under 1ms and most of it is planning time. Use a prepared statement or do something else to reduce planning time like reducing statistics target if that a

Re: PostgreSQL does not choose my indexes well

2020-04-25 Thread Arcadio Ortega Reinoso
I'm also wondering exactly which Postgres version this is. Also a good question. Thanks, Stephen postgresql-12/bionic-pgdg,now 12.2-2.pgdg18.04+1 amd64 [instalado] postgresql-client-12/bionic-pgdg,now 12.2-2.pgdg18.04+1 amd64 [instalado, automático] postgresql-client-common/bionic-pgdg,bioni

Re: The query plan get all columns but I'm using only one column.

2020-04-25 Thread Tom Lane
Moises Lopez writes: > -> Seq Scan on public.link l1 (cost=0.00..10.40 rows=40 width=516) > (actual time=0.010..0.011 rows=1 loops=1) > *Output: l1.id , l1.url, l1.name > , l1.description, l1.rel* This is normal; it is not a bug, and it is not a sou

Re: PostgreSQL does not choose my indexes well

2020-04-25 Thread Stephen Frost
Greetings, * Tom Lane (t...@sss.pgh.pa.us) wrote: > Stephen Frost writes: > > Turns out to be because what was provided wasn't actually what was being > > used- there's a domain in there and that seems to gum up the works and > > make it so we don't consider the partial index as being something w

The query plan get all columns but I'm using only one column.

2020-04-25 Thread Moises Lopez
We have production database that has slow queries because of the query get all columns even if I'm using only one column. The result is slow for tables that there are too much columns The weird part is that there is environment that I can't reproduce it even if they are using the same postgresql.co