This is the third time in my blog to repeat the isolation level of database transactions. This piece of content is a bit confusing. At that time, I understood it and I will forget it later. I think the trick to master the database transaction isolation level is to list the exceptions that occur during the transaction concurrency and the isolation level to prevent such exceptions. Next we will review the database transaction isolation level based on this idea.
The first possible exception: Lost update)
Database transaction isolation level:Read uncommittedThis exception can be avoided.
The second possible exception: Dirty read)
Database transaction isolation level:Read committedThis exception can be avoided.
Third possible exception: unrepeatable read)
Database transaction isolation level:Reaptalble readThis exception can be avoided.
Fourth possible exception: phantom read)
Database transaction isolation level:SerializableThis exception can be avoided.
The following table lists the isolation-level control capabilities for various exceptions.
|
Lu loss update |
Dr dirty read |
Nrr non-repeated read |
SlU Class II loss update |
PR phantom read |
Uncommitted read Ru |
Y |
Y |
Y |
Y |
Y |
Submit read RC |
N |
N |
Y |
Y |
Y |
Repeatable read rr |
N |
N |
N |
N |
Y |
Serial read S |
N |
N |
N |
N |
Y |