CHAPTER 9
Transactions and Concurrency
313
Unlike in READ UNCOMMITTED, in the READ COMMITTED isolation level, you don’t get dirty
reads. Instead, you can only read committed changes.
In terms of the duration of locks, in the READ COMMITTED isolation level, a reader only holds the
shared lock until it is done with the resource. It doesn’t keep the lock until the end of the transaction;
in fact, it doesn’t even keep the lock until the end of the statement. This means that in between two
reads of the same data resource in the same transaction, no lock is held on the resource. Therefore,
another transaction can modify the resource in between those two reads, and the reader might get
different values in each read. This phenomenon is called non-repeatable reads or inconsistent analy-
sis. For many applications, this phenomenon is acceptable, but for some it isn’t.
When you are done, run the following code for cleanup in any of the open connections.
UPDATE Production.Products
SET unitprice = 19.00
WHERE productid = 2;
Do'stlaringiz bilan baham: |