Fundamentals · Hard · Free
What is a database deadlock? How does the DB detect it?
FresherFundamentalsDatabase Fundamentals
DB deadlock
Two transactions wait on each other's locks—DB detects cycle in wait-for graph and aborts one victim (rollback).
- Retry with backoff in app
- Consistent lock order on tables
- Keep transactions short
Show deadlock graph A→B→A sketch.