mysql可重复读隔离级别问题--幻读

概念

【本文实验基于mysql5.7版本InnoDB引擎RR级别】

幻行官方描述

The so-called phantom problem occurs within a transaction when the same query produces different sets of rows at different times. For example, if a SELECT is executed twice, but returns a row the second time that was not returned the first time, the row is a “phantom” row.
当同一查询在不同时间产生不同的行集时,在事务内就会发生所谓的幻象问题。例如,如果SELECT执行两次,但是第二次返回的行却不是第一次返回,则该行是“幻像”行

幻读(高性能MySQL描述)

当某个事务在读取某个范围内的记录时,另一个事务又在该范围内插入了新的记录,当之前的事务再次读取某个范围的记录时,会产生幻行。

官方描述:

phantom
A row that appears in the result set of a query, but not in the result set of an earlier query. For example, if a query is run twice within a transaction, and in the meantime, another transaction commits after inserting a new row or updating a row so that it matches the WHERE clause of the query.

This occurrence is known as a phantom read. It is harder to guard against than a non-repeatable read, because locking all the rows from the first query result set does not prevent the changes that cause the phantom to appear.
Among different isolation levels, phantom reads are prevented by the serializable read level, and allowed by the repeatable read, consistent read, and read uncommitted levels.
google翻译:
在查询的结果集中出现的行,但在较早的查询的结果集中没有出现的行。例如,如果一个查询在一个事务中运行两次,与此同时,另一个事务将在插入新行或更新一行以使其与查询的WHERE子句匹配之后提交。 这种情况被称为幻像读取。与不可重复的读取相比,要防备更难,因为锁定第一个查询结果集中的所有行并不能阻止导致幻像出现的更改。 在不同的隔离级别中&#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值