Mistake: treating optimistic isolation as a magic bullet. SQL Server uses row versions in TempDB so readers and writers can avoid much of the locking and blocking found with pessimistic isolation, but the tradeoff is additional I/O and disk usage. section 10.12
Use these checks before choosing an optimistic isolation level:
- Consider Read Committed Snapshot for Read Committed behavior and Snapshot for Serializable-equivalent protection against data anomalies. section 10.12
- Check whether TempDB has spare I/O capacity and free disk space; busy systems may incur substantial version-store overhead. section 10.12 section 10.14
- Prefer diagnosis over adding hardware, and consider optimistic isolation when lock contention causes performance problems. section 10.14
MarketingArchive configuration
Enable database-level behavior with ALTER DATABASE MarketingArchive SET READ_COMMITTED_SNAPSHOT ON WITH NO_WAIT, or permit Snapshot isolation with SET ALLOW_SNAPSHOT_ISOLATION ON. Inspect stored row versions through sys.dm_tran_version_store. section 10.12
Listing 10.30 Enabling Read Committed Snapshot
ALTER DATABASE MarketingArchive SET READ_COMMITTED_SNAPSHOT ON WITH NO_WAIT ;
Shows the T-SQL command for enabling Read Committed Snapshot on a database. section 10.12
Listing 10.31 Enabling Snapshot isolation
ALTER DATABASE MarketingArchive SET ALLOW_SNAPSHOT_ISOLATION ON ;
Shows the T-SQL command for allowing Snapshot isolation on a database. section 10.12
Listing 10.33 Examining the Version Store
SELECT * FROM sys.dm_tran_version_store ; COMMIT
Shows how to examine row versions in the Version Store. section 10.12
