Skip to content

Stedman SQL Podcast Sn 2 Ep 13 Blocking and Deadlocks

blocking and deadlocks

Stedman SQL Podcast Season 2 Episode 13 Blocking and Deadlocks

In this episode, we explore two of the most common performance issues in SQL Server: blocking and deadlocks. Although they might appear similar at first glance, they behave very differently and require different approaches to troubleshoot and resolve. You’ll learn what blocking is, why it happens, and when it’s considered normal. We’ll also explain what causes deadlocks, how SQL Server automatically handles them by killing one process, and why that matters for your applications. Along the way, we’ll walk through real-world examples, share tips to prevent both problems, and explain how indexing, query tuning, and good transaction practices can make all the difference.

Blocking vs Deadlocks in SQL Server – What’s the Difference? 🔄
In this video, we explore two of the most common performance issues in SQL Server: blocking and deadlocks. Although they might appear similar at first glance, they behave very differently and require different approaches to troubleshoot and resolve.

You’ll learn what blocking is, why it happens, and when it’s considered normal. We’ll also explain what causes deadlocks, how SQL Server automatically handles them by killing one process, and why that matters for your applications. Along the way, we’ll walk through real-world examples, share tips to prevent both problems, and explain how indexing, query tuning, and good transaction practices can make all the difference.

We’ll also show how Database Health Monitor helps detect blocking and deadlocks quickly—so you can fix them before they impact users.

If you’re dealing with persistent performance issues, check out our SQL Server Managed Services at https://stedmansolutions.com/managed-services/. You’ll get expert help, monitoring, and peace of mind.

Download Database Health Monitor at http://DatabaseHealth.com, and if you need assistance, reach out at https://stedmansolutions.com/contact-us/.

#SQLServer #Blocking #Deadlocks #DBA #SQLPerformance #StedmanSolutions #DatabaseHealthMonitor


Let me know if you want a shorter version for social sharing too.

You said:

write a blog post on this topic

ChatGPT said:

Absolutely! Here’s a blog post you can publish on the topic of Blocking vs Deadlocks in SQL Server, written in a style that matches my typical posts at SteveStedman.com:


Blocking vs Deadlocks in SQL Server – What’s the Difference?

In the world of SQL Server performance tuning, two of the most misunderstood issues are blocking and deadlocks. They can both slow down your system, frustrate users, and leave DBAs scrambling for answers—but they are not the same problem.

Let’s break down what each one is, how they’re different, and most importantly, how to detect and prevent them.


What is Blocking?

Blocking occurs when one session (SPID) holds a lock on a resource that another session needs. The second session simply has to wait until the first one finishes. This is completely normal behavior in SQL Server—it’s how transaction isolation ensures consistency.

For example, if one user is updating a row in a table and another user tries to read or update that same row, the second user is blocked until the first transaction commits or rolls back.

Blocking becomes a problem when it lasts too long or creates a chain reaction where multiple sessions are waiting, leading to a performance bottleneck.


What is a Deadlock?

A deadlock is different—and more serious. It’s when two (or more) sessions are waiting on each other in a circular loop, and neither can proceed.

Let’s say:

  • Session A locks row 1 and wants row 2.
  • Session B locks row 2 and wants row 1.

They’re now stuck. Neither can continue unless the other releases its lock—but they’re both waiting on each other.

SQL Server detects this situation quickly and picks a “deadlock victim”, rolling back one of the transactions to break the cycle. That’s why, if you’ve ever seen the error “Transaction (Process ID XX) was deadlocked on resources with another process…”, it means SQL Server had to kill your session to let the other proceed.


Key Differences

  • Blocking is often temporary and self-resolving.
  • Deadlocks are permanent unless SQL Server intervenes.
  • Blocking is one-way waiting. Deadlocks are circular.
  • Blocking doesn’t automatically fail your query. Deadlocks do.

How to Detect Blocking and Deadlocks

Blocking

You can detect blocking using DMVs like sys.dm_exec_requests and sys.dm_os_waiting_tasks, or better yet, by using Database Health Monitor—our free tool that gives you a live view of blocking chains and who is holding things up.

Deadlocks

Deadlocks are trickier. You can enable trace flags or use Extended Events to capture deadlock graphs. But again, Database Health Monitor simplifies this by logging deadlocks as they happen and giving you a visual breakdown of what went wrong.

👉 Download Database Health Monitor here


How to Prevent Them

For blocking:

  • Keep transactions short.
  • Avoid unnecessary locking hints.
  • Use proper indexing to reduce table scans.

For deadlocks:

  • Access tables in the same order across all transactions.
  • Minimize lock time by avoiding user interaction inside transactions.
  • Consider lowering the isolation level when appropriate.

And of course—monitor continuously. These problems often go undetected until they hit hard.


Need Help?

If blocking or deadlocks are plaguing your SQL Server—and you’re tired of chasing ghosts—Stedman Solutions can help.

Our SQL Server Managed Services include continuous monitoring, expert tuning, and real-time alerting for blocking and deadlocks. You’ll be supported by a team of US-based senior DBAs with decades of experience (yes, I’ve been working with SQL Server since 1990!).

We help you fix the root cause, not just patch symptoms.

📞 Contact us today to discuss how we can help stabilize and optimize your SQL Server environment.

Don’t forget to check out our previous episodes from Season one!

 

More from Stedman Solutions:

SteveStedman5
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!

Leave a Reply

Your email address will not be published. Required fields are marked *

fifty three + = fifty eight