Prevention of Anomalies in Isolation Levels

In this lesson, we will identify which isolation level prevents which anomalies.

Isolation level that prevents all of the anomalies

There is one isolation level that prevents all of these anomalies: the serializable one.

Like the consistency models presented in the Consistency Models lesson, this level provides a more formal specification of what is possible, e.g., which execution histories are possible. More specifically, it guarantees that the result of the execution of concurrent transactions is the same as that produced by some serial execution of the same transactions. This means that we can only analyze serial executions for defects. If all the possible serial executions are safe, then any concurrent execution by a system at the serializable level will also be safe.

However, serializability has performance costs since it intentionally reduces concurrency to guarantee safety.

Other isolation levels

Isolation levels other than the serializable ones are less strict and provide better performance via increased concurrency at the cost of decreased safety.

These models allow some of the anomalies we described previously. The following illustration contains a table with the most basic isolation levels, along with the anomalies they prevent.

Get hands-on with 1200+ tech skills courses.