Concurrency and isolation
Isolation, RCSI and snapshot
Define the consistency you need.
Understand the concept
READ UNCOMMITTED permits dirty reads. Lock-based READ COMMITTED avoids uncommitted changes but does not freeze data between statements. REPEATABLE READ protects read rows; SERIALIZABLE also protects ranges against phantoms. Stronger isolation can increase waiting.
With READ_COMMITTED_SNAPSHOT enabled, READ COMMITTED uses statement-level row versions. SNAPSHOT provides a transaction-level view when allowed in advance and can encounter update conflicts. Versioning does not eliminate all locks or costs. Version storage and long readers require monitoring. This lesson does not change database options; those need operational assessment. Restore the session isolation level after experiments.
Choose consistency for a transaction scenario.
Assuming RCSI and SNAPSHOT have the same scope.
One topic. Three levels of depth.
DBCC USEROPTIONS;Displays session settings.
This page does not execute SQL. Practise in the downloadable SqlStudioLab using SSMS. Before rerunning temporary-table examples, remove only the relevant #table. Views, procedures and functions create persistent lab objects; never use a production connection.
Try it yourself first.
Read the current database’s RCSI state without changing it.
Show the solution and explanation
SELECT name, is_read_committed_snapshot_on FROM sys.databases WHERE name = DB_NAME();1 means enabled and 0 disabled; do not enable it casually.