CS FundamentalsHardIBM · Deloitte pattern

A long-running read-only transaction under snapshot isolation sees a consistent view of the database as of its start time, even while other transactions keep committing new changes. What must the database do to make this possible?

  1. A. Retain old row versions (multiversioning) that are still needed by this transaction's snapshot, even if newer versions have since been committed, until the long-running transaction finishes and those old versions can be garbage-collected
  2. B. Immediately abort the long-running transaction
  3. C. Convert the long-running transaction to READ UNCOMMITTED automatically
  4. D. Block every other transaction from committing until the long read finishes

Correct answer: A. Retain old row versions (multiversioning) that are still needed by this transaction's snapshot, even if newer versions have since been committed, until the long-running transaction finishes and those old versions can be garbage-collected

Snapshot isolation is typically implemented via MVCC: the engine must keep the versions of rows as they existed at the snapshot's start, even as newer committed versions pile up, so the long-running transaction can keep reading its original consistent view — this is exactly the version-retention cost of MVCC discussed earlier, made concrete by a single long transaction holding back cleanup.

More DBMS and SQL questions

Exams that ask this topic