我知道
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 中提交一些更改?所以基本上这是同一个问题的两种不同后果,对吧?
不可重复读取中的差异始终是 UPDATE 语句的结果,而在幻像读取的情况下,它也可能是 INSERT 或 DELETE 的结果。此外,第一种情况可以通过锁定行来防止,而不是第二种情况。