为什么默认情况下未启用 READ_COMMITTED_SNAPSHOT?

发布于 2024-08-03 02:55:13 字数 247 浏览 8 评论 0原文

简单的问题?

为什么READ_COMMITTED_SNAPSHOT默认情况下未启用?

我猜测要么是向后兼容性,要么是性能,或者两者兼而有之?

[编辑] 请注意,我感兴趣的是与 READ_COMMITTED 隔离级别相关的效果,而不是快照隔离级别。

为什么这是一个重大更改,因为它持有较少的锁,并且仍然不读取未提交的行?

Simple question?

Why is READ_COMMITTED_SNAPSHOT not on by default?

I'm guessing either backwards compatibility, performance, or both?

[Edit] Note that I'm interested in the effect relating to the READ_COMMITTED isolation level, and not the snapshot isolation level.

Why would this be a breaking-change, as it holds less locks, and still doesn't read non-committed rows?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

浪漫之都 2024-08-10 02:55:13

默认情况下打开快照会破坏绝大多数应用程序

我不清楚它是否会破坏“绝大多数”应用程序。或者,它是否会以难以识别和/或难以解决的方式破坏许多应用程序。 SQL Server 文档指出,READ COMMITTED 和 READ COMMITTED SNAPSHOT 均满足 READ COMMITTED 的 ANSI 定义。 (此处说明:http://msdn.microsoft.com/en-us/library /ms189122.aspx)因此,只要您的代码不依赖于超出字面 ANSI 要求的行为之外的任何内容,理论上就可以了。

一个复杂的问题是,ANSI 规范并没有涵盖人们通常认为的脏读、模糊/不可重复读等实际含义的所有内容。而且,在READ COMMITTED SNAPSHOT 下可能会发生一些在READ COMMITTED 下不会发生的异常情况(ANSI 定义所允许的)。有关示例,请参阅 http://www.jimmcleod.net/blog/index.php/2009/08/27/the-潜在-危险-of-the-read-commited-snapshot-isolation-level /

另请参阅 http://social .msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/d1b3d46e-2642-4bc7-a68a-0e4b8da1ca1b

有关隔离级别之间差异的深入信息,请从 http://www.cs 开始。 umb.edu/cs734/CritiqueANSI_Iso.pdfREAD_COMMITTED_SNAPSHOT 在撰写本文时还不存在,但其他级别已包含在其中)。

Turning snapshot on by default would break the vast majority of applications

It is unclear to me if it will break the "vast majority" of applications. Or, if it will break many applications in ways that are hard to identify and/or hard to work around. The SQL Server documentation states that READ COMMITTED and READ COMMITTED SNAPSHOT both satisfy the ANSI definition of READ COMMITTED. (Stated here: http://msdn.microsoft.com/en-us/library/ms189122.aspx) So, as long as your code does not rely on anything beyond the literal ANSI-required behavior, in theory, you will be okay.

A complication is that the ANSI specification doesn't capture everything that people commonly think things like dirty read, fuzzy/non-repeatable read, etc. mean in practice. And, there are anomalies (permitted by the ANSI definitions) that can occur under READ COMMITTED SNAPSHOT that cannot occur under READ COMMITTED. For an example, see http://www.jimmcleod.net/blog/index.php/2009/08/27/the-potential-dangers-of-the-read-committed-snapshot-isolation-level/.

Also see http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/d1b3d46e-2642-4bc7-a68a-0e4b8da1ca1b.

For deep information on the differences between the isolation levels, start with http://www.cs.umb.edu/cs734/CritiqueANSI_Iso.pdf (READ_COMMITTED_SNAPSHOT was not around when this paper was written, but the other levels are covered by it).

纵性 2024-08-10 02:55:13

两个都。主要是兼容性。

默认情况下打开快照会破坏绝大多数期望旧的阻塞行为的应用程序。快照大量使用tempdb作为版本存储,它对性能的影响是相当可衡量的。

Both. Mostly compatibility.

Turning snapshot on by default would break the vast majority of applications that expect the old, blocking, behavior. Snapshot makes heavy use of tempdb for the version store and its impact on performance is quite measurable.

独守阴晴ぅ圆缺 2024-08-10 02:55:13

它改变了 Sybase/SQL Server 系列一直以来的默认锁定策略。它会破坏我所有的应用程序,我在我的商店中知道的所有应用程序,并损坏许多重要数据。

阅读维基百科文章 完全:您想要您的银行应用程序要使用这种隔离模型吗?

一般来说,快照
隔离带来了一些问题
维护重要的约束
给用户,他们可能不欣赏
要么是潜在的陷阱,要么是
可能的解决方案。这样做的好处
传输是更好的性能。

与大多数数据库设计一样,这是一种折衷方案。就我而言,我可以处理锁定等待/死锁(罕见),作为更轻松、更“开箱即用”的数据完整性的代价。我还没有遇到过将快照隔离视为解决方案的问题。

It changes the default locking strategy from how the Sybase/SQL Server family have worked forever. It'd break all my applications, all the application I know of at my shop, and corrupt a lot of important data.

Read the Wikipedia article completely: do you want the code behind your banking app to use this isolation model?

In general, therefore, snapshot
isolation puts some of the problem of
maintaining non-trivial constraints
onto the user, who may not appreciate
either the potential pitfalls or the
possible solutions. The upside to this
transfer is better performance.

It's a compromise like most database designs. In my case, I can deal with the locking waits/deadlocks (rare) as a price for easier and more "out of the box" data integrity. I've yet to come across a problem or issue where I see snapshot isolation as a solution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文