Configuration parameter

lock_timeout — PostgreSQL Configuration Parameter

Category Client Defaults Default 0 Unit time (ms/s/min) Change scope Per-session (SET)

Abort a statement waiting too long for a lock.

At a glance

Property Value
Parameter lock_timeout
Category Client Defaults
Default 0
Value type time (ms/s/min)
Change scope Per-session (SET)

What it does

Limits how long a statement waits to acquire a lock before aborting (SQLSTATE 55P03). 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 lock_timeout; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'lock_timeout';.

Tuning guidance

Set a short value (e.g. 2-5s) before DDL/migrations so a blocked ALTER TABLE fails fast instead of queuing behind it and blocking every following query.

Reference

PostgreSQL documentation — Client Defaults configuration.

Was this helpful?

← All configuration parameters