[英]How does transaction isolation level work with respect to read/writes and read/write locks?
I understand the dirty read, non-repeatable read and phantom read issue.我了解脏读、不可重复读和幻读问题。
Also I have read about isolation levels: read uncommitted, read committed, repeatable read, serializable.我还阅读了有关隔离级别的信息:未提交读、已提交读、可重复读、可序列化。
I also understand that reading results in a shared lock.我也明白读取会导致共享锁。 To get a shared lock there shouldnt already be an active exlcusive lock.
要获得共享锁,不应该已经有一个活动的排他锁。 Where as insert/update/delete results in an exclusive lock.
其中插入/更新/删除会导致排他锁。 To get an exclusive lock there shouldn't be any other exclusive or shared lock active.
要获得排他锁,不应该有任何其他排他或共享锁处于活动状态。
For each level, none of the articles I have read explain the isolation level concept with respect to:对于每个级别,我读过的文章都没有解释隔离级别的概念:
Whether the level is applicable to a read or write transaction or both.该级别是否适用于读取或写入事务或两者。
Whether reading/writing enforces any read/write locks different to the above explanation读/写是否强制执行与上述解释不同的任何读/写锁
Transaction is a all or nothing concept with regards to write.事务是关于写入的全有或全无的概念。 Whereas is transaction isolation level a concept with regards to reads only?
而事务隔离级别是关于只读的概念吗?
If anyone can enlighten regarding these points for each level then it will be very helpful.如果有人可以就每个级别的这些要点进行启发,那将非常有帮助。
You might find these articles by Paul White to be very useful .您可能会发现Paul White 的这些文章非常有用。
But in answer to your questions:但在回答您的问题时:
Firstly, Shared vs Exclusive locks define what is allowed to happen concurrently against the lock.首先,共享锁与排他锁定义了允许对锁同时发生的事情。 The isolation level defines how much is locked and how long for.
隔离级别定义了锁定的数量和锁定时间。
SNAPSHOT
in particular has different effects depending whether a write is involved or not. SNAPSHOT
尤其具有不同的效果,具体取决于是否涉及写入。NOLOCK
).NOLOCK
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.