Deadlocks and Conflict Resolution

Introduction

A deadlock happens when two or more transactions each hold a lock the other needs, so none of them can move forward. Transaction A holds a lock on row 1 and asks for row 2; transaction B holds row 2 and asks for row 1. Neither will release what it holds until it gets what it wants, so the wait is circular and permanent unless the database steps in. This is different from ordinary blocking, where one transaction simply waits for another that will eventually finish and commit.

Because a deadlock cannot resolve itself, database engines must detect the cycle and break it by choosing a victim transaction to roll back, or avoid the cycle entirely through prevention strategies such as consistent lock ordering, shorter transactions, lower lock footprints, and timeout policies that abandon a wait after a set interval. Victim selection is usually based on which transaction is cheapest to undo, though the rolled-back transaction's work is lost and must be retried by the application. This topic matters in this course because the locking and isolation choices you studied earlier directly determine how often deadlocks occur in a real multi-user system.

As you watch, look for three things: the exact interleaving of lock requests that forms the cycle, how the engine reports and diagnoses the deadlock (error messages, deadlock graphs, trace or Extended Events output), and what the presenter recommends to reduce recurrence. Keep in mind that the videos use SQL Server and Azure SQL as their demonstration platform; the specific tools differ across engines, but the underlying cycle, detection, and victim-selection logic are general.

Video 1: Waiting due to deadlocks [6 of 7] | Azure SQL for beginners

Microsoft Developer · 10:38 · 3,079 views · 3y ago · captions — Watch on YouTube

About this video

Part of Microsoft's Azure SQL for beginners series on performance troubleshooting, this episode focuses on waiting caused by deadlocks between concurrent SQL users. Based on its title and description, it should walk through a scenario in which users block each other, show how the condition appears as a waiting or performance problem, and explain how the engine responds. Expect the discussion to be framed around diagnosing symptoms you would actually see in a running database.

Why this video

It comes directly from Microsoft Developer, so the behavior described reflects how the engine genuinely handles deadlock detection and resolution, and its troubleshooting framing supports the detection and conflict-resolution subtopics.

Video 2: SQL Server Deadlock: Causes, Detection & Solutions

Tech Yatra(Nishant Gupta) · 12:17 · 1,613 views · 3y ago · captions — Watch on YouTube

About this video

This video is organized around the three questions this topic asks: what causes deadlocks, how to detect them, and how to resolve them. The description promises practical examples and best practices, so expect demonstrations of transactions that deadlock in SQL Server along with guidance on reducing their frequency. It should give you concrete language for describing causes rather than only abstract theory.

Why this video

Its cause-detection-solution structure maps closely onto the detection, prevention, and best-practices subtopics, making it a useful single-pass overview of the whole topic.

Video 3: Understanding and Visualizing Database Deadlocks: A Practical SQL Guide

Better Dev with Anubhav · 12:59 · 4,774 views · 3y ago · captions — Watch on YouTube

About this video

This walkthrough builds a deadlock from a simple SQL query sequence and then visualizes what is happening between the competing transactions. The emphasis on visualization suggests it will make the mutual blocking cycle concrete by showing which resource each transaction holds and which it is waiting for. It is presented as a practical, hands-on guide rather than a lecture.

Why this video

Visualizing the lock-wait cycle is the clearest way to understand how deadlocks form, which makes this a strong companion to the more troubleshooting-oriented videos.

How These Videos Support the Learning Outcomes

These three videos target MO5 most directly: together they show how a deadlock forms, how the engine detects and breaks it, how victim selection and timeouts resolve the stalemate, and which design practices reduce recurrence — the raw material for building a deadlock mitigation plan. They also reinforce MO4, since deadlocks are a consequence of pessimistic, lock-based concurrency control and illustrate the cost side of that strategy, and they indirectly connect to MO3 by showing how stricter isolation and longer lock holds raise deadlock risk. Pair them with your readings on ACID and isolation anomalies (MO1 and MO2), which these videos assume rather than teach.

About These Videos

These videos were chosen from YouTube on October 2, 2026. Each has captions; the player turns them on. Videos on YouTube can be changed or removed — if one no longer plays, tell your instructor. If a player does not appear, use its Watch on YouTube link.