SQL Server: What is SNAPSHOT Isolation Level?

The SNAPSHOT Isolation Level constructed based on MVCC – Multiversion Concurrency Control Architecture.
This is also one of the my favourite Isolation level because I like the concept of row versioning.

Before further discussion on SNAPSHOT,
You guys should know What is MVCC?

Other RDBMS like: MySQL InnoDB Engine and PostgreSQL is based on MVCC Architecture.

The SNAPSHOT Isolation level does not block your any transaction for inserting, updating or selecting the data because it is managing and storing different versions of the data into TempDB.

When you are reading the data in one transaction and the meanwhile another transaction is updating the same data and it keeps old version of data into TempDB so that you can still read the same value.

When you read the same data next time, you always get new version of data from primary storage and it removes old version of data from the TempDB.
Your read transaction does not block any other write transaction and Your write transaction does not block any other read transaction.

You cannot enable SNAPSHOT Isolation level at statement level.
You have to enable at the database level and after enabling all your database transactions will execute in MVCC fashion.

Script to Enable SNAPSHOT Isolation Level:

Script to Disable SNAPSHOT Isolation Level:

Anvesh Patel

Leave a Reply

Be the First to Comment!

Notify of