【问题标题】:non-repeatable read vs. phantom read不可重复读与幻读
【发布时间】:2017-08-24 08:11:26
【问题描述】:

我知道

A non-repeatable read occurs, when during the course of a transaction, a row is 
retrieved twice and the values within the row differ between reads.

A phantom read occurs when, in the course of a transaction, two identical queries are executed, and the collection of rows returned by the second query is different from the first.

我猜这是因为在这两个原因中我们都在事务 A 中,而事务 B 只是提交了一些更改。

所以我的问题是......是否有来自两者或 1 的另一个用例,原因可能不是事务 B 只是在我们处于事务 A 时提交一些更改?所以基本上这是同一个问题的两种不同后果,对吧?

【问题讨论】:

  • 不一定

标签: isolation-level isolation transaction-isolation


【解决方案1】:

不可重复读取中的差异始终是 UPDATE 语句的结果,而在幻读的情况下,也可能是 INSERT 或 DELETE 的结果。 此外,第一种情况可以通过锁定行来防止,而不是第二种情况。

【讨论】:

    猜你喜欢
    • 2012-06-18
    • 2013-08-20
    • 1970-01-01
    • 1970-01-01
    • 2016-07-13
    • 2016-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多