The deadlocks plot shows the rate of deadlock creation in the database.
Deadlocks occur when two or more transactions have simultaneous, conflicting locks on the same database object. PostgreSQL will abort at least one of the deadlocked transactions.
To identify the transactions involved in a deadlock, refer to the deadlock error details in your PostgreSQL logs. Look for log entries with process 12345 detected deadlock
. It may also be helpful to correlate the PostgreSQL error timestamp with the same time point in your application logs to understand the deadlock triggers.
You can prevent deadlocks by ensuring that all applications that use the database acquire locks on multiple objects in a consistent order.
For more information on monitoring PostgreSQL clusters, see How to Monitor PostgreSQL Database Performance.