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

2021-03-07 Thread Francesco De Angelis
Hi all, I would appreciate if somebody could help me understanding why the query described below takes very different execution times to complete, almost completely randomly. I have two very "simple" tables, A and B: CREATE TABLE A ( a1 varchar(10) NULL, a2 varchar(10) NULL, v int4 NULL ); CREATE

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 À : [email protected] Objet : Fwd: different execution time for the same que

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