statement_timeout
No restart — settable per sessiontuned by pgconfiguratortime (ms); 0 disables
Aborts any single statement that runs longer than this — a runaway-query guard.
What pgconfigurator would set
32 GB · 8 vCPU · NVMe · OLTP
Computing…
Tune for your exact server → /tunecomputed in your browser · nothing uploaded
What it does
If a statement runs longer than statement_timeout, PostgreSQL cancels it and returns an error. It's a safety valve against runaway queries monopolizing resources, and a way to enforce latency SLAs.
How to tune it
Don't set a tight global timeout that kills legitimate reports — instead set a generous global value (or 0) and tighten it per role/session for interactive paths (SET statement_timeout). For background/maintenance roles you may want it off. Migrations and big batch jobs need it disabled or very high.
FAQ
- Where should I set statement_timeout?
- Per role or per session, not as a blanket global. Give web/app roles a tight limit, give reporting and maintenance roles a generous one or none. A single global value either kills real reports or fails to protect the fast paths.