DSA Factory
Free Transactions and concurrency lessonsTransactions and concurrency · Stage 2 · Control and recovery · Step 2

Deadlocks and MVCC

See how locking can deadlock and how the database breaks it, and how keeping old versions lets readers avoid waiting. About 15 minutes.

Quick check

Under MVCC, a long report reads a table while a stream of updates changes it. What happens to the report?

  1. AIt reads a consistent snapshot without blocking the updates or waiting for them
  2. BIt blocks all updates until it finishes
  3. CIt sees a mixture of old and new values as they change
Show the answer

It reads a consistent snapshot without blocking the updates or waiting for them. Readers see the versions committed as of their snapshot.

Lock it in

4 questions on this idea

Short questions that apply the idea to new cases: trace it, work out a number, put steps in order. A wrong answer explains itself.

Answer them in your browserFree account, no card. Your progress is saved, and the idea comes back in a quick review later.
Sign up free to solve