Some time ago, one of my colleagues asked me, “What do you like about SQL Server the
most?” I had heard this question many times before, and so I provided my usual answer:
“SQL Server Internals. I like to understand how the product works and solve complex
problems with this knowledge.”
His next question was not so simple though: “How did you fall in love with SQL
Server Internals?” After some time thinking, I answered, “Well, I guess it started when
I had to work on the locking issues. I had to learn SQL Server Internals to troubleshoot
complex deadlocks and blocking conditions. And I enjoyed the sense of satisfaction
those challenges gave me.”
This is, in fact, the truth. The Concurrency Model has always been an essential part
of my SQL Server journey, and I have always been fascinated by it. Concurrency is,
perhaps, one of the most confusing and least understood parts of SQL Server, but, at the
same time, it is also quite logical. The internal implementation is vaguely documented;
however, as soon as you grasp the core concepts, everything starts to fit together nicely.
It is also fair to say that concurrency topics have always been my favorites. My first
few SQL Saturday presentations and first few blog posts were about locking and blocking.
I even started to write my first book, the first edition of Pro SQL Server Internals, from
Chapter 17—the first chapter in the “Locking, Blocking, and Concurrency” part—before
going back to write the beginning.
Those few chapters, by the way, were the first and worst chapters I have ever written.
I am very glad that I had an opportunity to revisit them in the second edition of Internals
book. Nevertheless, I was unable to cover the subject as deeply as I wanted to due to
deadlines and space constraints (I am sure that Apress regularly ran out of paper printing
the 900-page manuscript in its current form). Thus, I am very glad that I can present you
with a separate book on SQL Server locking, blocking, and concurrency now.
If you have read Pro SQL Server Internals before, you will notice some familiar
content. Nevertheless, I did my best to expand the coverage of the old topics and added
quite a few new ones. I also made many changes in the demo scripts and added the new
Blocking Monitoring Framework code, which dramatically simplifies troubleshooting
concurrency issues in the system.