[英]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.