I am trying to understand what is the performance cost of enabling log_lock_waits on Postgres.

As per this documentation, while log_lock_waits = on:

Controls whether a log message is produced when a session waits longer than deadlock_timeout to acquire a lock. This is useful in determining if lock waits are causing poor performance. The default is off. Only superusers can change this setting.

But it doesn't say how much it hinders performance and I can't find it anywhere else.

1 Answer 1


This is essentially for free, and you should enable it in all databases unless the workload is designed to have long lock waits regularly (which would be a design bug).

These error messages are written by the deadlock detector, which is expensive to run, which is why PostgreSQL doesn't run it unless someone has to wait deadlock_timeout seconds for a lock. 1 second is very long, so this should not happen normally (database transactions should be way shorter).

But the deadlock detector has to run anyway, and these log messages are just a side effect you get for free.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.