| Home | Previous Lesson: Isolation Levels Next Lesson: Non-Repeatable Reads |
A dirty read occurs when one transaction modifies a row and a second one reads it, before the first has been able to commit the change. If the first transaction rolls back the changes, the information read by the second transaction becomes invalid.
For example, Tran1 reads the row for product_no 10, with a product_balance of 120, and updates it to 100, but the transaction is not yet committed. In the mean time, Tran2 reads the same row and gets the product_balance as 100. Now Tran1 issues a ROLLBACK, which sets the product_balance to its previous value of 120. At this moment, Tran2 thinks the product_balance as 100, when it really is 120:
| Home | Previous Lesson: Isolation Levels Next Lesson: Non-Repeatable Reads |