Multiple choices questions in DBMS, Interview questions in RDBMS, What is phantom read? Example transactions that result in phantom read, define phantom read, given a schedule find the problem in it
RDBMS solved MCQ - Phantom read and concurrency control
Next > |
1.
What is the problem with the following schedule?
a) Repeatable read
problem
b) Lost update
problem
c) Phantom read
problem
d) Dirty read
problem
Answer: (c) Phantom
read problem Transaction T1
finds the number of records (count) of Employee table, updates the salary of
all employees using the count, and then commits. Transaction T2 inserts a new
record into Employee table and commits. Suppose that
Employee has 50 records before T2 starts. That makes the value of X 50. Now, T2
inserts a new record and commits. Hence, the actual count becomes 51. So,
UPDATE statement in T1 updates all the salaries (including
the one which is newly inserted – the phantom read) by using the X
value as 50 (not as 51). What is phantom read?The so-called
phantom problem occurs within a transaction when the same query produces
different sets of rows at different times. For example, if a SELECT is
executed twice, but returns a row the second time that was not returned the
first time, the row is a “phantom” row. A phantom read occurs when a transaction retrieves a set of rows twice and new rows are inserted into or removed from that set by another transaction that is committed in between. |
Next > |
- Go to Multiple Choice Questions in DBMS home
- Go to Normalization - MCQs page
- Go to General Mixed Quiz in all topics of DBMS page
Go to Advanced DBMS Concepts page