Chaturmind
LearnDSASystem DesignBlogPremium
Sign inGet started
Chaturmind

Structured learning paths for engineers who want to go deep. Written by practitioners.

Learn

  • Java
  • DSA
  • System Design
  • Spring Boot
  • AI / ML

Company

  • Blog
  • Premium
  • Contact

Legal

  • Privacy Policy
  • Terms of Service

© 2026 Chaturmind. All rights reserved.

Built for engineers who want to go deep.


← Database Fundamentals

Database Foundations

  • ACID Properties
  • Indexes & Query Performance
  • Transactions & Isolation Levels

Database Design

  • Normalization (1NF–3NF)
  • SQL Joins & Set Operations
  • Window Functions
Chaturmind
← Database Fundamentals

Database Foundations

  • ACID Properties
  • Indexes & Query Performance
  • Transactions & Isolation Levels

Database Design

  • Normalization (1NF–3NF)
  • SQL Joins & Set Operations
  • Window Functions
HomeLearnDatabasesDatabase FundamentalsTransactions & Reliability
✓ FreeIntermediate· 12 min read

ACID Properties

Understand Atomicity, Consistency, Isolation, and Durability — the four guarantees that make database transactions reliable.

Published April 1, 2025


ACID Properties

ACID is an acronym for the four properties that guarantee database transactions are processed reliably. Every serious database interview starts here.

A — Atomicity

"All or nothing"

A transaction is treated as a single unit. Either all operations succeed, or none of them are applied. If a failure occurs mid-transaction, the database rolls back to its previous state.

-- Transfer $100 from Alice to Bob
BEGIN TRANSACTION;
  UPDATE accounts SET balance = balance - 100 WHERE name = 'Alice';
  UPDATE accounts SET balance = balance + 100 WHERE name = 'Bob';
COMMIT; -- Both succeed, or neither applies

If the system crashes after the first UPDATE but before the second, the rollback ensures Alice's money is returned.

C — Consistency

"Data is always valid"

A transaction moves the database from one valid state to another. All integrity constraints (foreign keys, unique constraints, check constraints) must hold before and after the transaction.

-- Consistency: balance cannot go negative
ALTER TABLE accounts ADD CONSTRAINT chk_balance CHECK (balance >= 0);

If Alice only has $50 and you try to debit $100, the constraint prevents the transaction from completing — consistency is maintained.

I — Isolation

"Concurrent transactions don't interfere"

Concurrently executing transactions behave as if they were executed serially. The intermediate state of a transaction is invisible to others.

Isolation levels (weakest to strongest):

LevelDirty ReadNon-Repeatable ReadPhantom Read
READ UNCOMMITTEDYesYesYes
READ COMMITTEDNoYesYes
REPEATABLE READNoNoYes
SERIALIZABLENoNoNo
-- Set isolation level
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN TRANSACTION;
  SELECT balance FROM accounts WHERE name = 'Alice'; -- reads 500
  -- Another transaction cannot change Alice's balance until this commits
  SELECT balance FROM accounts WHERE name = 'Alice'; -- still reads 500
COMMIT;

D — Durability

"Committed data survives failures"

Once a transaction is committed, it persists permanently — even if the system crashes immediately after. Databases achieve this through write-ahead logging (WAL): changes are written to a durable log before being applied to data files.

How Databases Implement ACID

  • Atomicity → undo logs / rollback segments
  • Consistency → constraint checks, triggers
  • Isolation → locks, MVCC (Multi-Version Concurrency Control)
  • Durability → write-ahead log (WAL), checkpointing

MVCC — How Modern Databases Achieve Isolation Without Blocking

PostgreSQL, MySQL InnoDB, and MongoDB all use MVCC. Instead of locking rows for reads, they keep multiple versions of each row. Readers see a consistent snapshot; writers create new versions.

Transaction T1 (reads at time=10):         Transaction T2 (writes at time=12):
SELECT balance → sees version@t=10 (500)   UPDATE balance SET balance=400
                                            → creates new version@t=12 (400)
SELECT balance → still sees @t=10 (500)    COMMIT
                ← T1 is unaffected!
COMMIT

Interview Tips

  1. Don't confuse Consistency here with CAP Consistency — CAP's C is about distributed systems agreement; ACID's C is about data validity constraints.
  2. Isolation is the most nuanced — be ready to explain the four levels and the anomalies each prevents.
  3. Durability trade-off — fsync=off in PostgreSQL is faster but violates durability. Mention this trade-off.
  4. Classic question: "What happens if the database crashes after COMMIT but before writing to disk?" Answer: WAL ensures the committed data is recoverable.

Next

Indexes & Query Performance

AI Tutor

Lesson: ACID Properties

Quick actions

AI responses can be inaccurate. Verify critical information.