Log into a MySQL session: SET TRANSACTION ISOLATION LEVEL < isolationlevel >; ST
ID: 3835708 • Letter: L
Question
Log into a MySQL session:
SET TRANSACTION ISOLATION LEVEL < isolationlevel >;
START TRANSACTION;
SELECT * from < table >
UPDATE/INSERT/DELETE ....
finally COMMIT or ROLLBACK to end transaction.
If you do not start a transaction then each individual query is treated as a separate transaction.
Alternatively, you could turn autocommit off. Note that isolation levels are relevant only for reads
from database; all writes to the database require exclusive locks.
(Q) Reconsider the above question when transaction T1 rollbacks. Consider table R(a) with
values (1, 2).
T1:
Update R Set a = a + 1;
Insert into R Values (4);
Rollback;
T2:
Select Sum(a) From R;
Select Sum(a) From R;
Commit;
Give all possible outputs of T2 when
(a) T2 executes with isolation level Serializable.
(b) T2 executes with isolation level Repeatable-Read where phantom tuples are evaluated.
List only those outputs that do not overlap with level Serializable.
(c) T2 executes with isolation level Read-Committed. List only those outputs that do not
overlap with level Serializable.
(d) T2 executes with isolation level Read-Uncommitted; assume that table R is updated
after getting a lock on the entire table.
List only those outputs that do not overlap with READ UNCOMMITTED when T1
commits - FOR option (d)
Explanation / Answer
T1 will get commited when the rollback is getting executed..
as per option d... table R is updated which represents the table is commited since it is updated by getting lock and the lock will get released after the update operation completed.
Now t2 will execute without any dependency...
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.