Re: different execution time for the same query (and same DB status)

2021-03-10 Thread Francesco De Angelis
Hello, many thanks to all the persons who replied. I am back with the information requested in https://wiki.postgresql.org/wiki/Slow_Query_Questions. Here you can find the results of the EXPLAIN commands: 1) First execution: https://explain.depesz.com/s/X2as 2) Second execution (right after the fir

Re: different execution time for the same query (and same DB status)

2021-03-08 Thread Michael Lewis
You don't mention shared_buffers, which is quite low by default. Not sure of the memory of your docker container, but it might be prudent to increase shared_buffers to keep as much data as possible in memory rather than needing to read from disk by a second run. To test the possibility Tom Lane sug

Re: different execution time for the same query (and same DB status)

2021-03-07 Thread Tom Lane
Julien Rouhaud writes: > +1, and more generally please follow > https://wiki.postgresql.org/wiki/Slow_Query_Questions. Yeah. FWIW, the most likely explanation for the change in behavior is that by the time of the second execution, auto-analyze has managed to update the table's statistics, and th

Re: different execution time for the same query (and same DB status)

2021-03-07 Thread Julien Rouhaud
On Sun, Mar 07, 2021 at 03:51:05PM +0100, Michel SALAIS wrote: > > Have you tried to use EXPLAIN ANALYZE at least? > > It could give valuable information about why this is occurring. +1, and more generally please follow https://wiki.postgresql.org/wiki/Slow_Query_Questions.

RE: different execution time for the same query (and same DB status)

2021-03-07 Thread Michel SALAIS
Hi, Have you tried to use EXPLAIN ANALYZE at least? It could give valuable information about why this is occurring. Michel SALAIS De : Francesco De Angelis Envoyé : samedi 6 mars 2021 22:40 À : pgsql-performance@lists.postgresql.org Objet : Fwd: different execution time for the same que