Problem Statement
What is a practical strategy to reduce deadlocks in a high-contention workload?
Explanation
A consistent access order removes cycles in the wait graph. Combine with shorter transactions and appropriate indexes to narrow lock scopes.
NOLOCK can read uncommitted data and produce inconsistent results. Long timeouts only hide the problem.
Code Solution
SolutionRead Only
-- Always lock parent, then child -- e.g., update account, then update its orders
Practice Sets
This question appears in the following practice sets:
