When a Postgres query suddenly jumps from 20ms to 2 seconds under load, check
temp_blks_written in pg_stat_statements. That usually means a sort or hash join outgrew work_mem and started spilling temporary files straight to disk.commit 10cb8fb