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

2020-04-30 Thread Moises Lopez
Michael, Your complete explanation is very helpful! I appreciate it Thank you so much! Regards! El jue., 30 abr. 2020 a las 10:52, Michael Lewis () escribió: > In staging environment we have disabled autovacuum since that it is a >> testing environment and the database are restored very often.

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

2020-04-30 Thread Michael Lewis
> > In staging environment we have disabled autovacuum since that it is a > testing environment and the database are restored very often. > But in production environment it is enabled autovacuum=on > > The weird case is that production was slow and staging environment was > faster. > You haven't s

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

2020-04-29 Thread Michael Lewis
It is generally a very bad idea to turn off autovacuum. When it is causing problems, it is likely that it needs to run more often to keep up with the work, rather than not run at all. Certainly if it is turned off, it would be critical to have a regularly scheduled process to vacuum analyze all tab

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: 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