// postgresql · timeouts

deadlock_timeout

How long to wait on a lock before checking for a deadlock.

Predeterminado
1s
Range
1ms to about 24 days
Restart needed
No
Default checked on
PostgreSQL 18

Lo que hace

Deadlock detection is expensive, so it runs only after a wait reaches this length. The same delay decides when log_lock_waits writes its message.

Valor predeterminado

1s. 1s (PostgreSQL 18).

Check the current value

SHOW deadlock_timeout;

SELECT setting, unit, boot_val, context, source, pending_restart
FROM pg_settings
WHERE name = 'deadlock_timeout';

Change it

SET deadlock_timeout = '200ms';   -- this session

ALTER SYSTEM SET deadlock_timeout = '200ms';
SELECT pg_reload_conf();

No restart. Superusers, or roles granted SET on the parameter (PostgreSQL 15 and later), can SET it per session; a server-wide ALTER SYSTEM change applies after a reload (context is superuser).

When to change it

Lower it a little if deadlocks are frequent and you want them broken faster, or raise it on servers with heavy, short lock waits to avoid needless checks.

What can go wrong

Very low values run the detector on ordinary short waits.

Questions about deadlock_timeout

What is the default value of deadlock_timeout in PostgreSQL?

1s. 1s (PostgreSQL 18).

Does changing deadlock_timeout require a restart?

No. No restart. Superusers, or roles granted SET on the parameter (PostgreSQL 15 and later), can SET it per session; a server-wide ALTER SYSTEM change applies after a reload (context is superuser).

When should I change deadlock_timeout?

Lower it a little if deadlocks are frequent and you want them broken faster, or raise it on servers with heavy, short lock waits to avoid needless checks.

Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.

// one client for every engine

Check deadlock_timeout on your own server

SQLly runs the query above against PostgreSQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.