Dirty reads
|
User 1 modifies a row. User 2 reads the same row before User 1 commits. User 1 performs a rollback. User 2 has read a row that has never really existed in the database. User 2 may base decisions on false data.
|
Non-repeatable reads
|
User 1 reads a row, but does not commit. User 2 modifies or deletes the same row and then commits. User 1 rereads the row and finds it has changed (or has been deleted).
|
Phantom reads
|
User 1 uses a search condition to read a set of rows, but does not commit. User 2 inserts one or more rows that satisfy this search condition, then commits. User 1 rereads the rows using the search condition and discovers rows that were not present before.
|
Read uncommitted (0)
|
Locks are obtained on modifications to the database and held until end of transaction (EOT). Reading from the database does not involve any locking.
|
Read committed (1)
|
Locks are acquired for reading and modifying the database. Locks are released after reading but locks on modified objects are held until EOT.
|
Repeatable read (2)
|
Locks are obtained for reading and modifying the database. Locks on all modified objects are held until EOT. Locks obtained for reading data are held until EOT. Locks on non-modified access structures (such as indexes and hashing structures) are released after reading.
|
Serializable (3)
|
All data read or modified is locked until EOT. All access structures that are modified are locked until EOT. Access structures used by the query are locked until EOT.
|
Level
|
Dirty Read
|
Nonrepeatable Read
|
Phantom Read
|
0, Read uncommitted
|
Yes
|
Yes
|
Yes
|
1, Read committed
|
No
|
Yes
|
Yes
|
2, Repeatable read
|
No
|
No
|
Yes
|
3, Serializable
|
No
|
No
|
No
|