Deadlock Prevention

Difficulty: Intermediate

Question

How do you prevent database deadlocks?

Answer

Access tables in a consistent order across all transactions, keep transactions short, and use lower isolation levels if appropriate.

Concepts covered

Deadlock, Wait-for-graph, Transaction Ordering