CS FundamentalsVery hardProduct company interview · GATE level
Transactions T1, T2 and T3 have timestamps 1, 2 and 3. All read and write timestamps of items A and C are initially 0, and the operations arrive in this order: R3(A); W2(C); W1(C); W2(A). Which transactions are rolled back under basic timestamp ordering, and which under timestamp ordering with Thomas's write rule?
- A. Basic: T1 and T2. With Thomas's write rule: T1 and T2
- B. Basic: T1 and T2. With Thomas's write rule: T2 only
- C. Basic: T1 only. With Thomas's write rule: none
- D. Basic: T2 only. With Thomas's write rule: T2 only
Correct answer: B. Basic: T1 and T2. With Thomas's write rule: T2 only
R3(A) sets read-TS(A) = 3. W2(C) sets write-TS(C) = 2. W1(C): T1's timestamp 1 is below write-TS(C) = 2 while read-TS(C) = 0, so it is an obsolete write - basic timestamp ordering rolls T1 back, but Thomas's write rule simply ignores the write and lets T1 continue. W2(A): T2's timestamp 2 is below read-TS(A) = 3, meaning a younger transaction has already read A; this write must be rejected and T2 rolled back under both schemes. Thomas's rule only forgives writes that are too late relative to another write, never relative to a read.
More DBMS and SQL questions
- A B+ tree uses 4096-byte blocks, 12-byte search keys, 8-byte block pointers and 10-byte record pointers. An internal node with p child…
- A B+ tree holds 10,000 keys in its leaves. A leaf holds at most 20 and at least 10 keys; an internal node has at most 30 and at least 15…
- A file has 200,000 fixed-length records of 200 bytes stored unspanned in 1024-byte blocks. A secondary index is built on a non-ordering…
- Relations R (1000 blocks) and S (200 blocks) are joined with a block nested-loop join using M = 52 buffer blocks: M - 2 blocks hold a…
- Table Product(pid, cat, price) rows: (1, 'X', 10), (2, 'X', 20), (3, 'Y', 20), (4, NULL, 30), (5, 'Y', NULL), (6, 'Z', 5). How many rows…
- Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4…