SQL Server快照隔离级别问题

发布于 2024-07-26 06:45:05 字数 452 浏览 6 评论 0原文

我正在从下面的链接研究 SQL Server 2008 的快照隔离级别。 我的困惑是,

http://msdn.microsoft.com/en-us/ library/ms173763.aspx

  1. 提到“当前事务开始后其他事务所做的数据修改对于当前事务中执行的语句不可见”。 -- 似乎其他事务提交的数据对于当前快照隔离级别事务不可见;

  2. 提到“在 SNAPSHOT 隔离级别下运行的事务可以查看该事务所做的更改”。 -- 似乎其他事务提交的数据对于当前快照隔离级别事务是可见的。

好像1和2有冲突? 任何意见?

提前致谢, 乔治

I am studying snapshot isolation level of SQL Server 2008 from the below link. My confusion is,

http://msdn.microsoft.com/en-us/library/ms173763.aspx

  1. It is mentioned "Data modifications made by other transactions after the start of the current transaction are not visible to statements executing in the current transaction." -- seems data committed by other transactions are not visible to the current snapshot isolation level transaction;

  2. It is mentioned "A transaction running under SNAPSHOT isolation level can view changes made by that transaction." -- seems data committed by other transactions are visible to the current snapshot isolation level transaction.

Seems 1 and 2 are conflicting? Any comments?

thanks in advance,
George

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

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

发布评论

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

评论(3

梨涡 2024-08-02 06:45:05

数字 2 表示“我可以看到自己的更改;我看不到其他更改”,

因此,如果我开始交易并进行更改,我可以看到它们。 在我的 TXN 之后启动的其他会话/连接的其他事务无法看到我的更改

Number 2 means "I can see my own changes; I can't see other changes"

So if I start a transaction and I make changes, I can see them. Other transactions for other sessions/connections started after my TXN can not see my changes

指尖微凉心微凉 2024-08-02 06:45:05

您还需要了解 SNAPSHOT 和 READ COMMITTED SNAPSHOT 之间的区别
- 对于后者,您需要修改 BOL 的报价,如下所示:

“当前交易开始后其他交易进行的数据修改
语句(不是事务!)对于当前事务中执行的语句不可见。”

一个产生重大差异的情况示例: 快照隔离何时有用、何时有害

You also need to know the difference between SNAPSHOT and READ COMMITTED SNAPSHOT
- for the latter, you need to modify your quote from BOL as follows:

"Data modifications made by other transactions after the start of the current
STATEMENT (not transaction!) are not visible to statements executing in the current transaction."

An example of a case when it makes a big difference: When Snapshot Isolation Helps and When It Hurts

任性一次 2024-08-02 06:45:05

你必须从大局考虑。 READ_COMMITTED仅有效/有用。 READ_UNCOMMITTED 有什么用? 哪些业务会需要脏读? 读连续剧? 为什么任何业务需求都会强制读取数据的顺序。 SQL Server 设计者没有费心去考虑简化。 Oracle 选择只支持一种并且它可以工作。 快照是数据库应该解决这个问题的方式,所以我们甚至不应该知道。 左脑应该致力于如何支持业务逻辑,而不是DB本身。

You have to think in big picture. READ_COMMITTED is only valid / useful. what will be use of READ_UNCOMMITTED? For what business will need dirty read? read serial ? Why any business requirement will force order on reading data. SQL server designer did not bother think about simplifying. Oracle chose to support only one and it works. Snapshot is how db should resolve this, so we shouldn't even know. With left brain, we should work on how to support business logic, not DB itself.

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