Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

transaction
sql
communitycreator

What are transaction isolation levels?

Buchiredddypalli Koushik

In transaction isolation, the following phenomena define the level:

  • Dirty Read: This occurs when we read the uncommitted data. We should not read the uncommitted data because it causes many errors in the database.

  • Non-Repeatable Read: A transaction reads the different values for the same variable.

  • Phantom Read: A phantom read occurs when one user repeats a read operation on the same records.

Isolation levels

There are four isolation levels in Structured Query Language.

The four isolation levels are:

  • Read Uncommitted: This is the lowest or bottom-most isolation level. In the read uncommitted stage, we may encounter errors like dirty read, lost updates, non-repeatable reads, or phantom read.

  • Read Committed: In the read committed stage, we may encounter errors like lost updates, non-repeatable reads, or phantom read. By following the read committed data, we overcome dirty read.

  • Repeatable Read: The transaction rereads the same data in the repeatable read stage. We may encounter errors like phantom read.

  • Serializable: In serializable, every transaction runs in sequential or serial order. We cannot modify the contents of the transaction if another transaction is reading it. In serializable, there will be no errors in the transaction.

Isolation levels

Isolation Level

Dirty read

Lost updates

Non repeatable read

Phantom Read

Read Uncommitted

may occur

may occur

may occur

may occur

Read Committed

don't occur

may occur

may occur

may occur

Repeatable read

don't occur

don't occur

don't occur

may occur

Serializable

don't occur

don't occur

don't occur

don't occur

RELATED TAGS

transaction
sql
communitycreator

CONTRIBUTOR

Buchiredddypalli Koushik
RELATED COURSES

View all Courses

Keep Exploring