Abort any statement running longer than this.
At a glance
| Property | Value |
|---|---|
| Parameter | statement_timeout |
| Category | Client Defaults |
| Default | 0 |
| Value type | time (ms/s/min) |
| Change scope | Per-session (SET) |
What it does
Aborts a statement that runs longer than the limit (raising SQLSTATE 57014). 0 disables.
How to apply a change
Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.
Inspect the current value and source with SHOW statement_timeout; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'statement_timeout';.
Tuning guidance
Set a sane ceiling (e.g. 30s-60s) per role/app to kill runaway queries — but never globally so low that legitimate maintenance fails. Set higher per-session for batch jobs.