Hi Friends,

It’s a well-known fact that READ UNCOMMITTED Isolation Level in SQL Server allows dirty reads. In other words, if a transaction is running under READ UNCOMMITTED Isolation Level, it does not honor any locks held by any other transaction. Did is say ‘any’? Well there is a small exception or twist to this.

Let’s take an example:

In connection 1, execute the following query:

In connection 2 (another query windows), execute the following query:

This query will wait. Note that this workload is running under READ UNCOMMITTED Isolation Level and thus should pass through but is being made to wait and no dirty read is possible. Why?

Because the previous query/transaction is holding schema modification lock on the object and the current (waiting query) needs Schema Stability lock.

See it for yourself. Run the following query in a new query window:

And check the output.

So, it is not completely true that READ UNCOMMITTED Isolation Level does not honor locks. It does, and this is just one of those scenarios.

Do share the post if you liked it. Thanks!