加入收藏 | 设为首页 | 会员中心 | 我要投稿 拼字网 - 核心网 (https://www.hexinwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql-server – SQL Server的READ COMMITTED SNAPSHOT vs SNAPSHO

发布时间:2021-03-05 02:16:30 所属栏目:MsSql教程 来源:网络整理
导读:我正在研究SQL Server的READ COMMITTED SNAPSHOT和SNAPSHOT隔离级别之间的差异,并且遇到了以下资源: Choosing Row Versioning-based Isolation Levels For most applications,read committed isolation using row versioning is recommended over snapshot i

我正在研究SQL Server的READ COMMITTED SNAPSHOT和SNAPSHOT隔离级别之间的差异,并且遇到了以下资源:

Choosing Row Versioning-based Isolation Levels

For most applications,read committed isolation using row versioning
is recommended over snapshot isolation for the following reasons:

  • It consumes less tempdb space than snapshot isolation.

  • Snapshot isolation is vulnerable to update conflicts that are not applicable to read committed isolation using row versioning. When a
    transaction running under snapshot isolation reads data that is then
    modified by another transaction,an update by the snapshot transaction
    to the same data causes an update conflict and the transaction
    terminates and rolls back. This is not an issue with read committed
    isolation using row versioning.

我对这些主题不太了解,但我似乎无法理解上面链接中的两个要点.

>为什么这些模式的t??empdb空间不同?是否存储比其他版本更精细的版本控制?
>为什么快照隔离更容易受到更新冲突的影响?

解决方法

> READ COMMITTED SNAPSHOT在每个语句后使用新快照.这意味着更少的行版本保持活着. (您从文档中引用的语句略有误导,因为它表明这始终是正确的 – 只有在长时间运行的SNAPSHOT事务中才会出现这种情况.)在写入时创建快照行版本.读取不影响放入tempdb的内容.作家不可能预见将来会进行哪些阅读.读者只会影响可以清除的内容. >当SNAPSHOT事务T1在T1启动和T1尝试写入之间的时间内写入由另一个事务T2修改的行时,该语句将失败并显示更新冲突错误.这是一种乐观的并发模型.使用READ COMMITTED SNAPSHOT T1将等待T2释放行上的X锁并继续正常.

(编辑:拼字网 - 核心网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读