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 suggested, do a manual analyze after data insert to see if it is also slow. Explain (analyze, buffers) select... and then using https://explain.depesz.com/ or https://tatiyants.com/pev/#/plans/new would be a good option to have some visualization on where the query is going off the rails.
- Fwd: different execution time for the same query (and... Francesco De Angelis
- RE: different execution time for the same query ... Michel SALAIS
- Re: different execution time for the same qu... Julien Rouhaud
- Re: different execution time for the sam... Tom Lane
- Re: different execution time for the... Michael Lewis
- Re: different execution time fo... Francesco De Angelis
- Re: Fwd: different execution time for the same q... Justin Pryzby
- Re: Fwd: different execution time for the sa... Francesco De Angelis
- Re: Fwd: different execution time for th... Michael Lewis
- Re: Fwd: different execution time fo... Francesco De Angelis
- How do we hint a query to use index in postgre Manish Lad
- Re: How do we hint a query to use index in p... Gaetano Mendola
- Re: How do we hint a query to use index ... Manish Lad
- Re: How do we hint a query to use in... Nikhil Shetty