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.
Published expected result
Longest lock wait by operation
| 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.
Continue from this lesson
Keep the result
Run this query on your own events
Create a free workspace only when you are ready to save the query, connect real events, and monitor the result. No credit card is required.