lock_timeout

A configuration parameter determining how long a session should wait to acquire a lock

lock_timeout is a configuration parameter determining the period of time which should elapse before an attempt to acquire a lock is abandoned.

lock_timeout was added in PostgreSQL 9.3.

Default value

The default value for lock_timeout is: 0 (disabled).

Usage

It is recommended to set lock_timeout at session level, rather than globally via postgresql.conf.

Change history

Examples

Usage example:

postgres=# SET lock_timeout = '10s';
SET

postgres=# BEGIN;
BEGIN

postgres=*# LOCK TABLE foo;
ERROR:  canceling statement due to lock timeout
Time: 10001.524 ms (00:10.002)

Categories

GUC configuration item, Locking

See also

deadlock_timeout, statement_timeout