Q30: What is a Database Deadlock, and how can it be prevented?
A deadlock occurs when two or more concurrent transactions hold locks on separate resources and each waits to acquire a lock held by the other, creating a circular dependency.
Circular Deadlock Condition
Key Takeaways
- Prevent deadlocks by accessing tables in a consistent order across all application transactions.
- Keep transactions small and avoid long interactive user prompts during open lock windows.