Impact
Blocking queries create a queue of dependent operations that cannot proceed, leading to application timeouts, connection pool exhaustion and degraded user experience.
Common causes
- Long-running transactions holding locks for extended periods
- Table-level locks from schema changes (ALTER TABLE, CREATE INDEX)
- Missing indexes causing queries to take more locks than necessary
Recommended actions
- Identify the blocking queries and the sessions they are blocking.
- Check how long the blocking transactions have been open.
- Set
statement_timeoutto prevent indefinite blocking.
Context (example)
blocking_pid 4127 · blocked 3 · wait 2 m 14 s