Isolation Levels and the Anomalies They Allow · seed 1 · A4, ink-friendly. The answer key prints on its own page for grown-ups.
به انگلیسی

Which wrong answers can you afford

Computing · Data & Databases · ages 20-21
Name ______________________   Date ____________
  1. Your range query lists five orders, then six on its rerun, because a new order arrived. Which anomaly is this?

    • A phantom read
    • A non-repeatable read
    • A deadlock
  2. Your transaction reads a stock count of 12, another transaction commits 9, and your next read gets 9. Which anomaly is this?

    • A dirty read of an uncommitted 9
    • A lost update
    • A non-repeatable read
  3. A dirty read sees data that was never committed.

    Circle one:   True   False

  4. Two transactions interleave to produce a phantom read. Which level would have prevented it?

    • Read committed, which is enough for new rows
    • Read uncommitted, the fastest choice
    • Serializable, which forbids phantoms
  5. Which level is the lowest one that forbids dirty reads?

    • Read uncommitted
    • Read committed
    • Repeatable read
  6. Which workload fits a weaker isolation level, and why?

    • A rough analytics count, as a stale total harms nobody
    • A bank balance, because money is simple
    • A seat booking, because the last seat rarely sells twice
  7. Pat claims that, by the SQL standard's definitions, repeatable read also forbids phantoms, since both involve rereading. What is wrong?

    • Nothing, the two anomalies are the same
    • Repeatable read forbids dirty reads only
    • Phantoms are new rows, not changed rows, and need serializable
  8. A booking system runs at read committed. Each booking checks that no booking row exists for the seat, then inserts one. Sometimes the last seat sells twice. Which level fixes it, and what does it forbid that the current one permits?

    • Read uncommitted, which is faster and looser
    • Serializable, which forbids the phantom that sneaks the second booking in
    • No level can help, since seats are not rows
LightMySky · lightmysky.comW1-mt_utxPNgxveB-s1

Answer key

For grown-ups. Fold this page away before handing over the rest.

Which wrong answers can you afford W1-mt_utxPNgxveB-s1

  1. A phantom read · New rows appearing in a repeated range query are phantoms.
  2. A non-repeatable read · The same query inside one transaction gave two different answers.
  3. True · Uncommitted data is exactly what makes the read dirty.
  4. Serializable, which forbids phantoms · Only the strongest level in the stack blocks brand-new rows.
  5. Read committed · Read committed is the first level that blocks uncommitted data.
  6. A rough analytics count, as a stale total harms nobody · Loose levels suit reads where small error costs nothing.
  7. Phantoms are new rows, not changed rows, and need serializable · Rereading old rows differs from new rows arriving, and each maps to its own level.
  8. Serializable, which forbids the phantom that sneaks the second booking in · The second booking is a new row the first check never saw.
Worksheet · LightMySky