Isolation Property in a Database

Isolation controls how and when changes are made in a database

Stock display screen board in street

dowell / Getty Images

Isolation is the database-level property that controls how and when changes are made and if they become visible to each other, users, and systems. One of the goals of isolation is to allow multiple transactions to occur at the same time without impacting the execution of each.

Isolation is an integral part of database transactional properties. It is the third property of ACID (Atomicity, Consistency, Isolation, Durability) and these properties ensure that data is consistent and accurate. 

How Isolation Works

Here is an example: If Joe issues a transaction against a database at the same time that Mary issues a different transaction, both transactions should operate on the database in an isolated manner. The database should either perform Joe’s entire transaction before executing Mary’s or vice-versa. This prevents Joe’s transaction from reading intermediate data produced as a side effect of part of Mary’s transaction that will not eventually be committed to the database.

It is important to note that the isolation property does not ensure that a specific transaction will execute first, only that they will not interfere with each other.

Isolation Levels

There are four levels of isolation. Higher isolation limits the ability of users to concurrently access the same data. The higher the isolation level, the greater system resources are required and the more likely database transactions will block one another.

As the isolation level is lowered, the more there is a chance that users will encounter read phenomena such as uncommitted dependencies, also known as dirty reads, which result in data being read from a row that has been modified by another user but not yet committed to the database.

  1. Serializable is the highest level, which means that the transactions will be completed before another transaction is able to start.
  2. Repeatable reads allow transactions to be accessed once the transaction has started, even though it hasn’t been finished.
  3. Read committed allows the data to be accessed after the data has been committed to the database, but not before then.
  4. Read uncommitted is the lowest level of isolation and allows data to be accessed before the changes have been made.