© Dmitri Korotkevitch 2016

Dmitri Korotkevitch, Pro SQL Server Internals, 10.1007/978-1-4842-1964-5_19

19. Deadlocks

Dmitri Korotkevitch

(1)Tampa, Florida, USA

A deadlock is a special blocking case when multiple sessions , or sometimes multiple execution threads within a single session, block each other. When it happens, SQL Server terminates one of the sessions, thus allowing others to continue.

This chapter demonstrates why deadlocks occur in the system and explains how to troubleshoot and resolve them.

Classic Deadlock

A classic deadlock occurs when two or more sessions are competing for the same set of resources. Let’s look at a by-the-book example and assume that you have two sessions updating two rows in the table in the opposite order.

As the ...

Get Pro SQL Server Internals, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.