Learn Labs
Transactions & Concurrency

Self-test

Check your understanding

Self-test7 questions

—/7
  1. Twenty threads doing read-then-write increments kept only 50 of 1,000. Why exactly 50?

  2. Why does UPDATE n = n + 1 never lose an increment under READ COMMITTED?

  3. REPEATABLE READ got the right total but needed 8,635 retries. What error did those transactions get, and what must the application do about it?

  4. In the on-call test, why could REPEATABLE READ not detect the conflict, while SERIALIZABLE caught it every time?

  5. What is the difference between a non-repeatable read and a phantom?

  6. Why are session advisory locks dangerous behind a transaction-pooling PgBouncer, and what should you use instead?

  7. Design question

    A booking system must never sell the same seat twice. Design the check-and-insert, and say which isolation level and which locks or constraints you would rely on.