Interview kitsBlog

Your dream job? Lets Git IT.
Interactive technical interview preparation platform designed for modern developers.

XGitHub

Platform

  • Categories

Resources

  • Blog
  • About the app
  • FAQ
  • Feedback

Legal

  • Privacy Policy
  • Terms of Service

© 2026 LetsGit.IT. All rights reserved.

LetsGit.IT/Categories/Databases
Databasesmedium

What is an isolation level (and why do we care)?

Tags
#transactions#isolation#concurrency
Back to categoryPractice quiz

Answer

Isolation defines what anomalies are allowed when transactions run concurrently (dirty/non-repeatable reads, phantoms). Higher isolation gives stronger correctness but may reduce concurrency and performance.

Advanced answer

Deep dive

Isolation level defines how your transaction behaves when other transactions read/write the same data. It’s a correctness vs concurrency trade-off.

Common phenomena:

  • **Dirty read**: reading uncommitted data.
  • **Non-repeatable read**: reading the same row twice yields different values.
  • **Phantom read**: re-running a range query returns different sets of rows.

Typical SQL isolation levels (conceptually):

  • `READ UNCOMMITTED` (allows dirty reads)
  • `READ COMMITTED` (no dirty reads, can have non-repeatable/phantoms)
  • `REPEATABLE READ` (stronger, depends on DB/MVCC)
  • `SERIALIZABLE` (strongest, but may abort transactions that can’t be serialized)

Practical guidance

  • Start with the DB default (often `READ COMMITTED`) and raise isolation only for the few operations that require it.
  • With `SERIALIZABLE`, be ready to retry transactions (serialization failures are normal under contention).

Common pitfalls

Related questions

Databases
Autocommit vs explicit transactions: when does it matter?
#database#transactions#autocommit
Databases
Isolation levels: what’s the difference between Read Committed, Repeatable Read, and Serializable?
#database#transactions#isolation
Databases
Deadlock: what is it and how do databases resolve it?
#database#transactions
  • Assuming the same isolation behaves identically across databases (implementation differs).
  • Long transactions + high isolation = more blocking/abort rates.
  • Trying to fix data races only by raising isolation instead of designing proper constraints/locking patterns.
  • #locks
    Databases
    Why are long transactions dangerous in production databases?
    #transactions#locks#mvcc
    Databases
    What is a deadlock in a database and how do you reduce it?
    #deadlock#locking#transactions
    Databases
    Optimistic vs pessimistic locking — what’s the difference?
    #locking#optimistic#pessimistic