What does isolation mean?
Isolation is a transaction property that guarantees: concurrent transactions don't see each other's unfinished changes, and don't interfere with each other's execution. Every transaction should feel like it's "the only one in the system", even when there are actually dozens running.
What this means in practice
- a transaction doesn't see intermediate, "dirty" data from other transactions
- concurrent operations don't produce contradictory results
- the overall effect should look as if the transactions ran one after another
Typical problems without Isolation
| Problem | What happens |
|---|---|
| Dirty Read | reading data from a transaction that hasn't been committed yet |
| Non-repeatable Read | reading the same field twice gives different results, because it was changed concurrently |
| Phantom Read | a repeated query returns a new set of rows added by another transaction |
Isolation protects against exactly these situations, depending on the isolation level.
Isolation levels (the idea, briefly)
Transactional systems have different levels, from faster but less strict, to maximally strict, for example:
Read CommittedRepeatable ReadSerializable(the strictest)
The higher the level, the less concurrency, but the more integrity guarantees.
In one sentence
Isolation = every transaction runs as if it were the only one, and never sees other transactions' unfinished changes.
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.