
Costs of Row Versioning-based Isolation Levels
Deciding to use row versioning-based isolation requires weighing the concurrency benefit of minimizing locking against increased resource usage needed to maintain and read row versions. Consider the following costs associated with enabling row versioning for the snapshot and read-committed isolation levels:
-
Read performance can be affected when versions needed by queries become old and long version chains must be scanned.
-
Row versioning increases resource usage during data modification as row versions are maintained in tempdb.
-
When either the READ_COMMITTED_SNAPSHOT or ALLOW_SNAPSHOT_ISOLATION database options are ON, update and delete transactions for a particular database must maintain row versions even when there are no transactions using a row versioning-based isolation level. Constructing a consistent snapshot of data using row versions involves system resources (CPU and memory), and potentially generates I/O activity. Because the record versions are stored in tempdb, performance is better and the number of issued I/Os is lower when more tempdb pages can be stored in memory for row versioning.
Note: |
|---|
|
Inserting a row generally does not generate a row version. Under certain conditions, however, the INSERT command does generate a row version. For example, if you insert a row into a table with a unique index when a previously deleted row version (ghost record) has not been truncated, the INSERT command generates a row version.
|
-
tempdb must have enough disk space for the version store. If there are very long-running transactions, all the versions generated by update transactions during the time must be kept in tempdb. If tempdb runs out of space, update operations do not fail, but read operations using row versioning might fail.
-
Row versioning information requires 14 bytes added to the database row.
-
Update performance can be slower due to the work involved in maintaining row versions. In typical OLTP workloads, each update changes just a few rows in a database. In these systems, the performance for updates in a database where the options are ON may be only a few percentage points slower compared to databases with both options OFF. The performance cost of versioned updates could be higher when larger amounts of data change during update operations.
-
Data readers face the extra cost of traversing the version link list. The older the snapshot, the slower the process of accessing it in a snapshot isolation transaction.
-
Some update transactions using snapshot isolation might have to be rolled back because of mandatory conflict detection for update operations. Transactions running under read-committed isolation using row versioning do not generate update conflicts.
Transactions using row versioning have other limitations. For more information, see Using Row Versioning-based Isolation Levels.