Select query with read uncommitted is causing the blocks

Surendra Adhikari 211 Reputation points
2020-11-05T08:11:21.507+00:00

There is a long stored procedure of select queries. The transaction is set to read uncommitted. The blocking report viewed in monitoring tool shows that this stored procedure is causing the block.
Can select queries with read uncommitted block other processes?

Developer technologies Transact-SQL
SQL Server Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Shashank Singh 6,251 Reputation points
    2020-11-05T08:19:59.853+00:00

    Can select queries with read uncommitted block other processes?

    Select queries in Read uncommitted isolation level will not take shared locks BUT takes Sch-S schema stability lock which is not compatible with any query which is trying to take schema level locks like Index rebuild, alter table. Such queries will be blocked by the select query you are running. Please see lock compatibility matrix. Its really a poor choice to use read uncommitted isolation level. Please read below to understand the problems you can get while using this isolation level.

    the-read-uncommitted-isolation-level

    1 person found this answer helpful.
    0 comments No comments

  2. CathyJi-MSFT 22,396 Reputation points Microsoft External Staff
    2020-11-06T09:42:54.767+00:00

    Hi @Surendra Adhikari ,

    READ UNCOMMITTED transactions will not take any database locks, but will still have to read databases pages to read the actual data. If other transactions are writing these pages at the same time, there might be some blocking between the two. Internally in the engine, we do not allow any transactions to read a page while a write is being in progress (we use latches to guarantee this). If a lot of transactions are writing while your big queries are going on, the big read might still become blocked.

    Best regards,
    Cathy


    If the response is helpful, please click "Accept Answer" and upvote it.
    Hot issues October--Users always get connection timeout problem when using multi subnet AG via listener. Especially after failover to another subnet


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.