Chapter 16. Dealing with Locking, Blocking, and Deadlocking

In this chapter we will cover:

  • Determining long-running transactions
  • Detecting blocked and blocking queries
  • Detecting deadlocks with SQL Server Profiler
  • Detecting deadlocks with Trace Flag 1204

Introduction

Transactions are an integral part of any OLTP database system. They manage data consistency and data concurrency issues, to make sure that data always remains in a valid state in the database, when multiple sources read or update the same data at the same time. In SQL Server, this is achieved through a locking mechanism that SQL Server applies while reading and writing data from and to the database. The lock manager in SQL Server is responsible for applying this locking mechanism. SQL Server ...

Get Microsoft SQL Server 2012 Performance Tuning Cookbook 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.