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?
- 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
- B. Immediately abort the long-running transaction
- C. Convert the long-running transaction to READ UNCOMMITTED automatically
- 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
- A relation R(A, B, C) has the single functional dependency A → B (C is independent, with no FD at all involving it, and no candidate key…
- A table's clustered index key is UUID-based (a random 128-bit value) rather than a sequential integer. What problem does this commonly…
- After a crash, the analysis phase of ARIES recovery scans the log forward from the last checkpoint to rebuild the transaction table…
- A relation Enrollment(studentid, courseid, semester, grade) has candidate key (studentid, courseid, semester). A functional dependency…
- A poorly designed table stores repeating groups as separate columns: Student(sid, sname, course1, course2, course3). What specific 1NF…
- A relation R(A, B, C, D) decomposes into R1(A, B) and R2(A, C, D). For this decomposition to be DEPENDENCY PRESERVING, what must hold?