← Back to Databases

ACID

DatabasesMiddb

The Question

What does ACID stand for and what does each property guarantee?

What a Strong Answer Covers

  • All four defined. Distinguish ACID consistency from CAP consistency.

Senior-Level Answer

ACID is an acronym for four properties that guarantee reliable processing of database transactions: Atomicity, Consistency, Isolation, and Durability.

Atomicity means a transaction is all-or-nothing. Every operation either completes successfully, or the entire transaction is rolled back. Consider a bank transfer: debiting one account and crediting another must both succeed or both fail. Without atomicity, money disappears from one account without appearing in the other.

Consistency ensures that a transaction brings the database from one valid state to another, respecting all defined rules such as constraints, cascades, and triggers. Violating consistency means your data integrity rules are broken.

Isolation means concurrent transactions execute as if they were serial. Without proper isolation, you encounter anomalies like dirty reads, non-repeatable reads, and phantom reads. Databases offer isolation levels — Read Uncommitted, Read Committed, Repeatable Read, and Serializable — each trading off correctness for concurrency.

Durability guarantees that once a transaction is committed, it survives system failures. This is typically achieved through write-ahead logging (WAL).

The key tradeoff is performance versus correctness. Full ACID compliance is expensive. Strict isolation requires locking or MVCC. Durability requires fsyncing to disk on every commit. This is why NoSQL databases often relax ACID — offering eventual consistency — to achieve higher throughput. The BASE model represents the other end of this spectrum.

In practice, the choice depends on the domain. Financial systems demand strong ACID. Analytics pipelines can tolerate relaxed guarantees.

What Separates a 2/3 from a 3/3

2/3 — Passing but Incomplete

Names and explains all four properties correctly but gives only surface-level examples and does not discuss tradeoffs or isolation levels.

3/3 — Strong Answer

Names and explains all four with concrete consequences of violating each, discusses isolation levels or MVCC, and articulates the performance-vs-correctness tradeoff including BASE.

Common Mistakes

  • Confusing Consistency in ACID with Consistency in CAP theorem
  • Failing to mention isolation levels
  • Not discussing any tradeoffs — presenting ACID as universally desirable
  • Giving vague definitions without concrete examples of what goes wrong
  • Forgetting durability or not mentioning WAL

Follow-Up Questions

  • How does MVCC achieve isolation without locking? — Each transaction sees a snapshot; writers don't block readers; conflict detection at commit time.
  • What is the difference between ACID consistency and CAP consistency? — ACID = data satisfies integrity constraints. CAP = all nodes return the same value.
  • When would you intentionally relax ACID guarantees? — High-throughput systems, event streaming, caching — where eventual consistency is acceptable.
  • What is a write-ahead log? — Changes logged to durable storage before being applied; enables crash recovery by replaying the log.
  • How do distributed databases achieve ACID across nodes? — Two-phase commit, Paxos/Raft consensus, TrueTime (Spanner).

Related Questions

  • Indexes
  • Clustered vs Non-clustered
  • Isolation Levels
  • Normalization
  • PostgreSQL Internals — MVCC, WAL, VACUUM

Can You Explain This Cold?

Reading the answer is step one. Explaining it unprompted — under interview pressure — is what actually matters. Get AI-graded feedback on your answer with follow-up probes on your weak points.

Get Graded — Free Assessment
GrindQuestionsAITechnical interview assessment
TermsPrivacyAbout