Transaction Management and Concurrency Control - ACID properties, serializability, lock-based concurrency control (2PL, deadlocks), time-stamping methods, optimistic methods - One Line Questions
1.
What is a deadlock in the context of concurrency control? —
A situation where two or more transactions are waiting indefinitely for each other to release locks
2.
Starvation in concurrency control refers to: —
A transaction being permanently prevented from executing or committing
3.
What problem does the 'phantom read' phenomenon refer to? —
A transaction re-executing a query and finding new rows that match the query criteria
4.
What is a 'dirty read' phenomenon? —
A transaction reads data that has been modified by another transaction but not yet committed
5.
In Strict Two-Phase Locking (Strict 2PL), when are all locks released by a transaction? —
At the commit or abort point of the transaction
6.
What is the core idea behind optimistic concurrency control methods? —
Assume conflicts are rare and check for them only at commit time
7.
If a transaction fails after committing some of its operations, which ACID property guarantees that the changes are permanent? —
Durability
8.
Which ACID property ensures that concurrent transactions do not interfere with each other's execution? —
Isolation
9.
What does the 'A' in ACID properties stand for? —
Atomicity
10.
Which type of serializability guarantees that the result is equivalent to *some* serial order of execution? —
Conflict Serializability
11.
Which ACID property ensures that a transaction is treated as a single, indivisible unit of work? —
Atomicity
12.
The concept of 'serializability' is crucial for ensuring: —
Data integrity in concurrent environments
13.
In lock-based concurrency control, what type of lock is acquired when a transaction wants to read a data item? —
Shared lock (S-lock)
14.
During the validation phase of optimistic concurrency control, what is checked? —
If the transaction's operations conflict with other concurrently committed transactions
15.
What is a potential drawback of optimistic concurrency control? —
It can cause frequent rollbacks if conflicts are high
16.
What is the primary disadvantage of using Strict 2PL compared to basic 2PL? —
It reduces concurrency by holding locks longer
17.
If a transaction fails validation in an optimistic concurrency control system, what typically happens? —
It is rolled back
18.
Which of the following is a common strategy for handling deadlocks? —
Transaction rollback
19.
Which type of concurrency control method creates multiple versions of data items? —
Multiversion Concurrency Control (MVCC)
20.
Which timestamp-based concurrency control method assigns a unique timestamp to each transaction? —
Time-stamping
21.
A cycle in the wait-for graph indicates: —
A deadlock
22.
Which of the following is a common technique to prevent deadlocks by breaking cycles in the wait-for graph? —
Preemption
23.
What is the weakest isolation level, allowing transactions to read uncommitted data from other transactions? —
Read Uncommitted
24.
Which isolation level ensures that if a transaction reads a data item, subsequent reads of the same data item within that transaction will return the same value? —
Repeatable Read
25.
Which isolation level allows dirty reads? —
Read Uncommitted
26.
Which isolation level would prevent phantom reads? —
Serializable
27.
Which isolation level guarantees that a transaction will see only committed data? —
Read Committed
28.
Optimistic concurrency control methods typically involve three phases: —
Read, Validate, Update
29.
What is the strongest isolation level, guaranteeing that concurrent transactions produce the same result as some serial execution? —
Serializable
30.
Which of the following lock modes are compatible with each other? (S-lock with S-lock, S-lock with X-lock, X-lock with X-lock) —
S-lock with S-lock
31.
What type of lock is acquired when a transaction wants to modify a data item? —
Exclusive lock (X-lock)
32.
Which lock mode prevents any other transaction from reading or writing the data item? —
Exclusive Lock (X-lock)
33.
In MVCC, when a transaction reads a data item, which version does it typically access? —
The version that was current when the transaction started
34.
Which of the following is a key consideration when choosing a concurrency control method? —
The expected frequency of conflicts
35.
If a transaction T tries to read a data item X, and T's timestamp is less than WTS(X), what action is typically taken? —
The read is rejected, and T is aborted
36.
In time-stamping methods, what is the 'write timestamp' (WTS) of a data item? —
The timestamp of the transaction that last wrote the data item
37.
In time-stamping methods, what is the 'read timestamp' (RTS) of a data item? —
The timestamp of the transaction that last read the data item
38.
In write-ahead logging, before modifying a data item on disk, the change must first be written to: —
The transaction log
39.
If a transaction T tries to write a data item X, and T's timestamp is less than RTS(X), what action is typically taken? —
The write is rejected, and T is aborted
40.
In timestamp ordering, if a transaction T attempts to write a data item X, and T's timestamp is less than RTS(X), what is the outcome? —
The write is rejected, and T is aborted.
41.
What is the main advantage of time-stamping methods over basic 2PL? —
They avoid deadlocks
42.
Which method is used to detect if a transaction has been waiting for a lock for an excessively long time, potentially indicating a deadlock? —
Lock timeout
43.
What is the purpose of a 'commit record' in transaction logging? —
To mark the successful completion of a transaction
44.
What is the primary purpose of Two-Phase Locking (2PL)? —
To ensure serializability
45.
What is the primary goal of serializability in transaction management? —
To ensure that concurrent execution of transactions produces the same result as some serial execution
46.
What is a 'write-ahead logging' (WAL) technique primarily used for? —
To ensure durability and atomicity of transactions
47.
What is the 'wait-for graph' used for in deadlock detection? —
To visualize dependencies between transactions waiting for resources
48.
The Consistency property of ACID ensures that a transaction brings the database from one valid state to another. —
True
49.
Two transactions T1 and T2 are in conflict if they access the same data item and at least one of the accesses is a write operation. —
True