Oracle DB Transactions — Read Skew

--

Transaction T1 reads x, and then a second transaction T2 updates x and y to new values and commits . If now T1 reads y, it may see an inconsistent state, and therefore produce an inconsistent state as output.

r1[x]…w2[x]…w2[y]…c2…r1[y]…(c1 or a1)

💡 How to read the shorthand notations? w means write, r means read, number(1 or 2) indicates transaction id, c means commit and a means abort/rollback

Example

Read Skew occurs in “READ COMMITTED” isolation level in Oracle
Read Skew does not occur in “SERIALIZABLE” isolation level in Oracle

Read skew is avoided in Oracle DB, provided there is a parent-child relationship between the tables which were read at different point-in-time.

💡Serializable isolation level in Oracle is actually a “Snapshot Isolation”

Transaction 1

Transaction 2

--

--

Prasad Jayakumar
Prasad Jayakumar

Written by Prasad Jayakumar

Learner, Mentor, Developer and an Architect

No responses yet