We just released our second eBook: "The Most Important Events to Monitor in Your Postgres Logs"Download Now

L72: Canceling statement due to lock timeout

Category: Lock Events
SQLSTATE: 55P03 (Class 55 - Object Not In Prerequisite State: lock_not_available)
Urgency: medium

Example Postgres Log Output:

ERROR: canceling statement due to lock timeout
CONTEXT: while updating tuple (24,41) in relation "mytable"
STATEMENT: UPDATE mytable SET y = 2 WHERE x = 1

Explanation:

This log event only occurs when lock_timeout was enabled for the connection, and the statement had to wait longer than the specified time for a lock.

Note that you won't see this message if statement_timeout is smaller than lock_timeout, as lock acquisition time is already included in the statement timeout.

It is not recommended to set this timeout for everything, instead only setting it for specific connections (e.g. by configuring it for a specific role that is used by web servers). Most of the time you will find statement_timeout more useful, unless you are exhibiting a lot of locking problems and have experimented with this setting before.

Recommended Action:

This points to a lock contention issue on your database, or another unexpected locking situation.

When log_lock_waits is enabled, L71 - Process still waiting for lock on tuple / relation / object can give more details on which processes are holding the requested lock.

Learn More:

No additional resources available.


Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →