How to fix blockings in sql server?

NN 0 Reputation points
2023-08-24T07:35:45.7466667+00:00

How to fix blockings in sql server?

SQL Server Other
{count} votes

3 answers

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2023-08-24T21:48:02.2166667+00:00

    Write better queries. Have better indexes so that queries run faster.

    0 comments No comments

  2. RahulRandive 10,486 Reputation points Volunteer Moderator
    2023-08-24T22:04:29.7233333+00:00

    Hi @NN

    Regardless of which blocking situation we are in, the methodology for troubleshooting locking is the same. Need to find the head blocker and identify what that query is doing and why it's blocking. Once the problematic query is identified (that is, what is holding locks for the prolonged period), the next step is to analyze and determine why the blocking happening. After we understand why, we can then make changes by redesigning the query and the transaction.

    Steps in troubleshooting:

    1. Identify the main blocking session (head blocker)
    2. Find the query and transaction that is causing the blocking (what is holding locks for a prolonged period)
    3. Analyze/understand why the prolonged blocking occurs
    4. Resolve blocking issue by redesigning query and transaction

    Here is detailed Microsoft document on Understand and resolve SQL Server blocking problems

    Resolve and Troubleshoot SQL Blocking chains with root sessions

    Troubleshooting blocking- https://www.mssqltips.com/sqlservertutorial/253/troubleshooting-blocking/

    Please find similar thread and blocking queries- https://learn.microsoft.com/en-us/answers/questions/1180235/blocking-gives-me-wrong-impression-in-this-scenari

    Thank you!


  3. Anonymous
    2023-08-25T05:43:17.13+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.