暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

MySQL 的可重复读

Renda 2021-04-27
337


我在这里分享一篇关于 MySQL 的可重复读介绍,讲得挺好的,可以解决一些疑惑,链接在下方引用处。


SQL 1992 年标准关于幻读 (Phantom) 的解释:


“一个事务 T1 根据某些查询条件 <search condition> 读取某几行数据,然后事务 T2 执行 SQL 语句插入一行或多行满足查询条件 <search condition> 的数据;这时候如果事务 T1 重复跟第一次查询一样的操作就会获取到不同的几行数据。”


幻读比起不可重复读更加侧重强调两次查询得到的行数不一样(多了或少了),或者行数一样但不是同一批(被替换了)。


这个是英文原版:

    P3 ("Phantom"): SQL-transaction T1 reads the set of rows N
    that satisfy some <search condition>. SQL-transaction T2 then
    executes SQL-statements that generate one or more rows that
    satisfy the <search condition> used by SQL-transaction T1. If
    SQL-transaction T1 then repeats the initial read with the same
    <search condition>, it obtains a different collection of rows.
    文章转载自Renda,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

    评论