Runbook

Postgresql Deadlocks Incident

Back to Runbooks

Overview

This incident type refers to the occurrence of deadlocks in a PostgreSQL database. A deadlock happens when two or more transactions are waiting for each other to release locks on resources, resulting in a situation where none of the transactions can proceed. This can cause significant disruption to the database and the applications that rely on it, as it prevents any further progress until the deadlock is resolved.

Parameters

Debug

Connect to the Postgresql instance

Show details of current locks

Show queries currently running on the instance

Show details of current transactions

Dump the Postgresql logs

Repair

Stop the Postgresql service

Wait for the service to stop

Start the Postgresql service

Wait for the service to start

Next Step

Increase the number of connections allowed to the database to reduce contention.

Identify the deadlocked queries and kill.

Learn more

Related Runbooks

Check out these related runbooks to help you debug and resolve similar issues.