ACID & Transactions

A transaction is a logical unit of work. ACID properties guarantee correctness even with crashes and concurrency.

Cheat sheet

  • ▸Atomicity: all or nothing (undo log).
  • ▸Consistency: moves DB from one valid state to another (constraints hold).
  • ▸Isolation: concurrent transactions behave as if serial.
  • ▸Durability: committed data survives crashes (redo log / WAL).
  • ▸States: Active → Partially committed → Committed, or → Failed → Aborted.
  • ▸COMMIT makes changes permanent; ROLLBACK undoes them.

ACID and who enforces it

PropertyMeaningMechanism
AtomicityAll or nothingUndo logs
ConsistencyRules always holdConstraints, app logic
IsolationNo interferenceLocks / MVCC
DurabilitySurvives crashWAL / redo logs

Top 10 campus interview questions

Quick quiz

1. 'All or nothing' is:

2. Durability is ensured by:

3. 2PL guarantees:

4. Serializability is tested with a:

5. Strict 2PL prevents: