Skip to content

Instantly share code, notes, and snippets.

@ideawu
Last active December 29, 2020 03:40
Show Gist options
  • Save ideawu/f08f49538bfb5085f3bf312f6e2f8927 to your computer and use it in GitHub Desktop.
Save ideawu/f08f49538bfb5085f3bf312f6e2f8927 to your computer and use it in GitHub Desktop.
Read Committed 事务隔离级别破坏了原子性吗?

Read Committed 级别只提到不返回中间态的脏数据, 但没提到是否要保证原子性.

例如, 事务 1 更新了 2 条记录 a 和 b, 另一个事务 2 依次去读 a, b. 当读到 a 为新值时, 再读 b 是旧值. 从因果关系上说, 这里违反了事务原子性. 如果先读到 a 是旧值, 再读 b 是新值, 则没有违反.

https://www.sqlskills.com/blogs/paul/read-committed-doesnt-guarantee-much/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment