Transaction Isolation Levels | Database Management System (DBMS) - Computer Science Engineering (CSE) PDF Download

Transaction Isolation Levels in DBMS

As we know that, in order to maintain consistency in a database, it follows ACID properties. Among these four properties (Atomicity, Consistency, Isolation and Durability) Isolation determines how transaction integrity is visible to other users and systems. It means that a transaction should take place in a system in such a way that it is the only transaction that is accessing the resources in a database system.
Isolation levels define the degree to which a transaction must be isolated from the data modifications made by any other transaction in the database system.
A transaction isolation level is defined by the following phenomena:

  • Dirty Read: A Dirty read is the situation when a transaction reads a data that has not yet been committed. For example, Let’s say transaction 1 updates a row and leaves it uncommitted, meanwhile, Transaction 2 reads the updated row. If transaction 1 rolls back the change, transaction 2 will have read data that is considered never to have existed.
  • Non Repeatable read: Non Repeatable read occurs when a transaction reads same row twice, and get a different value each time. For example, suppose transaction T1 reads data. Due to concurrency, another transaction T2 updates the same data and commit, Now if transaction T1 rereads the same data, it will retrieve a different value.
  • Phantom Read: Phantom Read occurs when two same queries are executed, but the rows retrieved by the two, are different. For example, suppose transaction T1 retrieves a set of rows that satisfy some search criteria. Now, Transaction T2 generates some new rows that match the search criteria for transaction T1. If transaction T1 re-executes the statement that reads the rows, it gets a different set of rows this time.

Based on these phenomena, The SQL standard defines four isolation levels:

  1. Read Uncommitted: Read Uncommitted is the lowest isolation level. In this level, one transaction may read not yet committed changes made by other transaction, thereby allowing dirty reads. In this level, transactions are not isolated from each other.
  2. Read Committed: This isolation level guarantees that any data read is committed at the moment it is read. Thus it does not allows dirty read. The transaction holds a read or write lock on the current row, and thus prevent other transactions from reading, updating or deleting it.
  3. Repeatable Read: This is the most restrictive isolation level. The transaction holds read locks on all rows it references and writes locks on all rows it inserts, updates, or deletes. Since other transaction cannot read, update or delete these rows, consequently it avoids non-repeatable read.
  4. Serializable:  This is the Highest isolation level. A serializable execution is guaranteed to be serializable. Serializable execution is defined to be an execution of operations in which concurrently executing transactions appears to be serially executing.

The Table is given below clearly depicts the relationship between isolation levels, read phenomena and locks:

Transaction Isolation Levels | Database Management System (DBMS) - Computer Science Engineering (CSE)

Anomaly Serializable is not the same as Serializable. That is, it is necessary, but not sufficient that a Serializable schedule should be free of all three phenomena types.

The document Transaction Isolation Levels | Database Management System (DBMS) - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Database Management System (DBMS).
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
62 videos|66 docs|35 tests

Top Courses for Computer Science Engineering (CSE)

FAQs on Transaction Isolation Levels - Database Management System (DBMS) - Computer Science Engineering (CSE)

1. What are transaction isolation levels in DBMS?
Ans. Transaction isolation levels in DBMS define the degree to which one transaction must be isolated from the effects of other concurrent transactions. It determines how changes made by one transaction are visible to other transactions before they are committed.
2. How many transaction isolation levels are there in DBMS?
Ans. DBMS typically provides four transaction isolation levels, which are: 1. Read Uncommitted: This is the lowest isolation level where transactions are not isolated from each other. It allows dirty reads, non-repeatable reads, and phantom reads. 2. Read Committed: In this isolation level, a transaction can only read committed data. It avoids dirty reads but allows non-repeatable reads and phantom reads. 3. Repeatable Read: This isolation level ensures that a transaction always sees the same committed data. It prevents dirty reads and non-repeatable reads but allows phantom reads. 4. Serializable: This is the highest isolation level that provides full isolation between transactions. It prevents dirty reads, non-repeatable reads, and phantom reads.
3. What is a dirty read in DBMS?
Ans. A dirty read in DBMS occurs when a transaction reads data that has been modified by another transaction but not yet committed. This means the read transaction may access uncommitted or invalid data, which can lead to incorrect results if the modifying transaction is rolled back.
4. What is a non-repeatable read in DBMS?
Ans. A non-repeatable read in DBMS occurs when a transaction reads the same data multiple times during its execution, but the data changes between the reads due to other concurrent transactions. This can lead to inconsistent or unexpected results within the same transaction.
5. What is a phantom read in DBMS?
Ans. A phantom read in DBMS occurs when a transaction retrieves a set of records based on a specific condition, but another concurrent transaction inserts or deletes records that meet the same condition. As a result, the first transaction sees a different set of records when it performs the same query again. This can lead to inconsistencies and unexpected results in the data retrieved by the transaction.
62 videos|66 docs|35 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Extra Questions

,

Summary

,

MCQs

,

Free

,

Objective type Questions

,

Transaction Isolation Levels | Database Management System (DBMS) - Computer Science Engineering (CSE)

,

Sample Paper

,

past year papers

,

mock tests for examination

,

Viva Questions

,

Transaction Isolation Levels | Database Management System (DBMS) - Computer Science Engineering (CSE)

,

video lectures

,

shortcuts and tricks

,

pdf

,

Semester Notes

,

Exam

,

study material

,

practice quizzes

,

ppt

,

Important questions

,

Transaction Isolation Levels | Database Management System (DBMS) - Computer Science Engineering (CSE)

,

Previous Year Questions with Solutions

;