Skip to main content

Transaction Anamolies

  • Dirty reads occur when:
    1. Transaction A inserts a row into a table.
    2. Transaction B reads the new row.
    3. Transaction A rolls back.
    Transaction B may have done work to the system based on the row inserted by transaction A, but that row never became a permanent part of the database.
  • Nonrepeatable reads occur when:
    1. Transaction A reads a row.
    2. Transaction B changes the row.
    3. Transaction A reads the same row a second time and gets the new results.
  • Phantom reads occur when:
    1. Transaction A reads all rows that satisfy a WHERE clause on an SQL query.
    2. Transaction B inserts an additional row that satisfies the WHERE clause.
    3. Transaction A re-evaluates the WHERE condition and picks up the additional row.

Comments