Share via

SQL Server blocking

PraveenKumar 316 Reputation points
2024-06-18T05:21:12.95+00:00

The attached query is causing blocking problems (root blocker) with other SQL statements. Can you please review the attached query and suggest If I need add/or remove indexes to prevent blocking. Please advise.

https://easyupload.io/zwcpgi

SQL Server | Other

Answer accepted by question author
  1. Anonymous
    2024-06-19T02:12:23.51+00:00

    Hi @PraveenKumar,

    Thank you for reaching out and welcome to Microsoft Q&A.

    Here is detailed document on Resolve and Troubleshoot SQL Blocking chains with root sessions. In addition to what Erland says, you can also try to build a covering index to resolve blocking issue.

    The link you provided shows me nothing, but I find a known issue about blocking and he posted the detailed query. Hope this thread can help you!

    Feel free to share your issue here if you have any confusions.

    Best regards,

    Lucy Chen


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    https://docs.microsoft.com/en-us/answers/support/email-notifications

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Erland Sommarskog 133.7K Reputation points MVP Volunteer Moderator
    2024-06-18T21:24:08.9333333+00:00

    The query could possibly run faster with an index on item_mandatory_condition_id, but that depends on how selective that column is.

    To avoid that SELECT queries causes blocking, you could consider setting the database in READ_COMMITTED_SNAPSHOT. In this mode, SELECT queries read from a version store to get was committed when the query started. But this also means that they could be reading stale data. This can be a problem in triggers that validates data.

    1 person found this answer helpful.
    0 comments No comments

Your answer

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