Question 71
HardIn wound-wait, T5 (older) requests a lock held by T9 (younger). What happens?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
DBMS
In wound-wait, T5 (older) requests a lock held by T9 (younger). What happens?
T5 is aborted
T5 waits
Both wait
T9 is wounded (aborted) and T5 gets the lock
Sign up free to see the answer and a step-by-step explanation.
Why do wait-die and wound-wait restart an aborted transaction with its original timestamp?
To speed up commits
Because timestamps can't change
To save log space
So it eventually becomes the oldest and can't starve
Sign up free to see the answer and a step-by-step explanation.
In multiple-granularity locking, a transaction wants to update one row of a table. What locks does it take?
S on the table and X on the row
IS on the table and X on the row
IX on the database and table, then X on the row
X on the whole database
Sign up free to see the answer and a step-by-step explanation.
Can a table hold an IS lock for T1 and an IX lock for T2 at the same time?
No
Yes, IS and IX are compatible
Only for one second
Only if T1 commits
Sign up free to see the answer and a step-by-step explanation.
A table holds an S lock for T1. Can T2 get an IX lock on the same table?
Only with SIX
Yes
Only if T2 is older
No, S and IX conflict
Sign up free to see the answer and a step-by-step explanation.
Under MVCC, how does a reader see a consistent snapshot?
It blocks writers
It reads the latest version committed before its snapshot time, ignoring newer versions
It locks every row
It reads uncommitted data
Sign up free to see the answer and a step-by-step explanation.
Which concurrency-control method suits a workload with many short read-mostly transactions and rare conflicts?
Wound-wait with long transactions
Serial execution
Strict 2PL with table locks
Optimistic concurrency control
Sign up free to see the answer and a step-by-step explanation.
What are the three phases of optimistic concurrency control?
Analysis, redo and undo
Read, validation and write
Lock, unlock and commit
Grow, shrink and commit
Sign up free to see the answer and a step-by-step explanation.
A phantom read can occur even under strict 2PL with row locks. Why?
Phantoms only happen without locks
Strict 2PL allows dirty reads
Row locks are never released
Row locks don't stop new rows from being inserted into a range being read
Sign up free to see the answer and a step-by-step explanation.
What is lock escalation and what is its risk?
Releasing locks early; it causes dirty reads
Replacing many row locks with one table lock; it can reduce concurrency and cause deadlocks
Using timestamps instead of locks
Upgrading S to X; it never causes problems
Sign up free to see the answer and a step-by-step explanation.