Troubleshooting Deadlocking

A deadlock in SQL Server consists of two threads that block each other, and each is waiting on the other to finish. This type of mutual blocking is commonly called a cycle, because you have two blockers in a kind of inverse relationship. SQL Server’s deadlock monitor process periodically checks for such cycles and chooses one of the tasks as a deadlock victim. The deadlock victim’s session has its batch aborted, its transaction rolled back, and it receives the following 1205 error message template (from the master.dbo.sysmessages system table):

Transaction (Process ID %d) was deadlocked on %.*ls resources with another process and has
been chosen as the deadlock victim. Rerun the transaction.

SQL Server will insert ...

Get Inside Microsoft® SQL Server™ 2005: Query Tuning and Optimization 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.