简体   繁体   English

可序列化和可重复读取隔离级别有什么区别?

[英]What is the difference between serializable and repeatable read isolation level?

What is the difference between serializable and repeatable read isolation level?可序列化和可重复读取隔离级别有什么区别? Can anyone please give a simple example.谁能举个简单的例子。

Summary: 摘要:

In a Repeatable Read isolation level, new rows can be inserted into the dataset. 在可重复读取隔离级别中,可以将新行插入到数据集中。

In a Serializable isolation level all the rows are locked for the duration of the transaction, no insert,update or delete is allowed. 在Serializable隔离级别中,所有行在事务持续期间都被锁定,不允许插入,更新或删除。

Please refer this for examples and explanation 请参考此示例和说明

Isolation Level - serializable 隔离级别 - 可序列化

http://beyondrelational.com/modules/2/blogs/28/posts/10467/sql-server-transaction-isolation-level-serializable.aspx http://beyondrelational.com/modules/2/blogs/28/posts/10467/sql-server-transaction-isolation-level-serializable.aspx

Isolation Level - repeatable-read 隔离级别 - 可重复读取

http://beyondrelational.com/modules/2/blogs/28/posts/10466/sql-server-transaction-isolation-level-repeatable-read.aspx http://beyondrelational.com/modules/2/blogs/28/posts/10466/sql-server-transaction-isolation-level-repeatable-read.aspx

Repeatable read prevents only non-repeatable read (so you can read the same data in the same transaction without fear of someone changing it - even though it's a rare need for doing it). 可重复读取仅防止不可重复读取(因此您可以在同一事务中读取相同的数据,而不必担心有人更改它 - 即使它很少需要这样做)。

Serializable prevents both non-repeatable read and phantom rows (so you can't even INSERT data). Serializable可以防止不可重复的读取和幻像行(因此您甚至无法插入数据)。 That means you can READ and WRITE (SELECT, UPDATE) rows that are not included with serializable transaction, but you can't DELETE OR INSERT rows on TABLE level. 这意味着您可以读取和写入(SELECT,UPDATE)可序列化事务中未包含的行,但不能在TABLE级别上删除或插入行。

Both repeatable read and serializable are very strict and there is not always need for them! 可重复读取和可序列化都非常严格,并不总是需要它们!

besides above, different implement is differed.除此之外,不同的实现是不同的。

such as mysql, the repeatable read will not cause phantom problem.比如mysql,repeatable read不会造成幻象问题。 as document作为文件

SERIALIZABLE enforces even stricter rules than REPEATABLE READ, and is used mainly in specialized situations, such as with XA transactions and for troubleshooting issues with concurrency and deadlocks. SERIALIZABLE 执行比 REPEATABLE READ 更严格的规则,并且主要用于特殊情况,例如 XA 事务以及解决并发和死锁问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “可重复读取”和“快照隔离”有什么区别 - What is the difference between "repeatable read" and "snapshot isolation" Update中的ReadCommitted和Repeatable Read隔离级别之间的差异 - Difference between ReadCommitted and Repeatable Read isolation level in Update 事务级别之间的差异:读可写和可隔离级别 - Differences between TRANSACTION's levels: READ WRITE and ISOLATION LEVEL SERIALIZABLE PostgreSQL 11 REPEATABLE READ 隔离级别 - PostgreSQL 11 REPEATABLE READ Isolation Level 了解 InnoDB 可重复读隔离级别快照 - Understanding InnoDB Repeatable Read isolation level snapshots 当 DELETE 或 UPDATE 查询进入可重复读取隔离级别时,背后的理论是什么? - What is the theory behind when DELETE or UPDATE query comes in a Repeatable Read Isolation Level? 可序列化的隔离级别 - 它会阻止读取吗? - Serializable isolation level - does it block read? 脏读和不可重复读之间有什么区别? - What is the difference between a dirty read and a non-repeatable read? 可重复读取隔离级别是否锁定所有表以进行更新? - Does repeatable read isolation level lock all table for update? SQL:在REPEATABLE READ隔离级别,是否在事务结束时持有UPDATE锁? - SQL: at REPEATABLE READ isolation level, are UPDATE locks held to the end of the transaction?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM