Database reliabilityIntermediate
Rank database lock waits and deadlocks
Which transaction families cause the longest waits and deadlocks?
Aggregate lock events by blocked operation to prioritize the most disruptive contention.
The dataset and query remain in this browser.
Published expected result
Longest lock wait by operation
ledger_rollup
6,200 ms
6,200 ms
payment_update
4,200 ms
4,200 ms
account_update
400 ms
400 ms
| blocked_operation | wait_events | max_wait_ms | deadlocks |
|---|---|---|---|
| ledger_rollup | 2 | 6,200 | 1 |
| payment_update | 3 | 4,200 | 1 |
| account_update | 1 | 400 | 0 |
How to read the query
- The blocked operation identifies the user-facing work delayed by contention.
- Maximum wait exposes severe tail behavior that an average can hide.
- Deadlock counts identify transaction pairs that need ordering or scope changes.
Decisions the SQL cannot make
- 1Inspect transaction order for operation families with deadlocks.
- 2Reduce transaction scope or batch size where waits are long but eventually resolve.
- 3Preserve the blocking-operation field in alerts so responders know where to start.