What are ACID Transactions?

Last updated: July 2026

An ACID transaction is a group of database operations that commits as one unit — atomic, consistent, isolated, and durable. The idea predates the acronym: Jim Gray defined the guarantees in 1981, Härder and Reuter named them ACID in 1983, and forty years later it remains the contract that lets you move money in software without occasionally inventing or destroying some.

Key takeaways

QuestionAnswer
The four lettersAtomic (all-or-nothing) · Consistent (rules hold) · Isolated (no interference) · Durable (survives crashes)
Canonical exampleThe bank transfer: debit + credit commit together or not at all
The dialIsolation levels — performance traded against read anomalies
The rivalBASE / eventual consistency — availability traded against staleness
The modern realityDocument databases do ACID too; the fine print is scope

How ACID Transactions Work in SQL (Bank-Transfer Example)

BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 'alice';
UPDATE accounts SET balance = balance + 100 WHERE id = 'bob';

-- Crash or error between the two updates? The engine rolls back:
-- ROLLBACK;  →  both changes vanish; money cannot evaporate

COMMIT;       -- or both become permanent, atomically, durably

Application code meets the same guarantees in smaller packages — atomic field operations that end the read-modify-write race, and batches that commit together:

// JavaScript / Node.js — Back4app JS SDK
// Atomicity where apps actually need it
counter.increment('sold', 1);        // atomic single-field update — no
await counter.save();                // read-modify-write race possible

// All-or-nothing batch: both rows commit, or neither does
await Parse.Object.saveAll([debitEntry, creditEntry], { transaction: true });

The Transaction Lifecycle: BEGIN, COMMIT, and ROLLBACK

Transaction lifecycleA transaction begins, performs operations against a working state, and either commits — making all changes permanent — or rolls back on any failure, restoring the previous valid state.

all succeed

any failure

BEGIN

Operations
reads + writes, isolated

COMMIT
permanent, durable

ROLLBACK
as if nothing happened

A transaction begins, performs operations against a working state, and either commits — making all changes permanent — or rolls back on any failure, restoring the previous valid state.

The four properties, each by what breaks without it: atomicity — without it, partial writes (the debited-but-never-credited transfer). Consistency — without it, committed states that violate your own rules (negative stock, orphaned references). Isolation — without it, concurrent transactions read each other’s half-finished work. Durability — without it, “committed” data that a crash quietly unwrites. Under the hood, three mechanisms deliver them: undo logs for rollback, write-ahead logging for crash survival, and locking or MVCC for concurrency.

Isolation levels vs. read anomalies

The matrix the SERP never assembles — which level stops which anomaly:

LevelDirty readNon-repeatable readPhantom readCost
Read uncommittedpossiblepossiblepossiblelowest
Read committedpreventedpossiblepossiblelow
Repeatable readpreventedpreventedpossiblemedium
Serializablepreventedpreventedpreventedhighest

Translations: a dirty read sees uncommitted work; a non-repeatable read gets different answers asking twice; a phantom sees rows appear mid-transaction. Most modern engines default to MVCC-based snapshot behavior — each transaction reads a consistent snapshot while writers proceed — which is why “readers don’t block writers” became the norm rather than the exception.

ACID vs. BASE — and the consistency homonym

DimensionACIDBASE
Optimizes forCorrectness per transactionAvailability at scale
ConsistencyImmediate, rule-preservingEventual
Natural homeMoney, inventory, bookingsFeeds, counters, caches
Scaling postureCoordination-boundHorizontal by design
Failure modeSlower under contentionTemporarily stale reads

One disambiguation carries this whole comparison: ACID’s C and CAP’s C are different words wearing the same letter. ACID consistency means each transaction preserves your declared rules. CAP consistency means all nodes agree right now. A single-node database is fully ACID without CAP entering the room; a distributed system chooses its CAP trade-off and its transactional guarantees separately.

Who guarantees what

Engine familyACID story
PostgreSQLFull ACID, MVCC, serializable available
MySQLFull ACID with InnoDB — engine choice matters
SQLiteFull ACID, single-writer, WAL mode
MongoDBSingle-document atomicity always; multi-document transactions since 4.0 (2018), snapshot isolation
Distributed SQL enginesACID via consensus replication — serializable at network prices
Wide-column / eventual storesTunable, partial — BASE by design

Distributed transactions deserve their honest footnote: two-phase commit buys cross-node atomicity at the price of latency and a blocking coordinator, which is why microservice architectures increasingly prefer sagas — sequences of local transactions with compensating rollbacks, trading immediate consistency for availability. If a workflow genuinely cannot tolerate compensation, that’s evidence it belongs inside one database, not across several.

Common use cases

  • Money movement. Transfers, payouts, ledgers — the canonical case and still the clearest.
  • Inventory and booking. Decrement stock and confirm the order together, or watch two customers buy the last seat.
  • Multi-row invariants. Order + line items, account + audit entry — records that are only valid born together.
  • Counters done right. Atomic increments — ACID’s smallest useful dose — end the read-modify-write race without full transactions.
  • The eventual-consistency complement. Feeds, likes, analytics: explicitly routed away from transactional cost, on purpose.

Must it be ACID? A decision matrix

Demand full transactions when…Eventual consistency is fine when…
Money or ownership changes handsA stale count costs nothing
Partial writes create invalid statesEach write is independently valid
Regulators will ask for the invariantThe data is derived and rebuildable
Two rows must agree, alwaysConvergence-later is acceptable UX
Overselling is a lawsuitOvercounting is a shrug

The craft is per-write routing: the checkout uses transactions, the view counter uses an atomic increment, the feed tolerates a second of drift — one application, three price points for consistency.

Limitations and trade-offs

  • Coordination is the cost center. Locks contend, WAL syncs hit disk, serializable retries abort — correctness has a throughput bill, which is the entire reason BASE exists.
  • Isolation levels are a loaded default. Most engines don’t default to serializable; know your level, or anomalies you thought impossible are merely unlikely.
  • Long transactions are a smell. Holding locks across user think-time or network calls turns guarantees into contention; keep transactions short and decisive.
  • Distributed ACID is expensive by nature. Consensus rounds per commit — pay it where invariants demand, not everywhere by reflex.
  • ACID can’t validate your rules for you. Consistency preserves declared constraints; business rules never encoded are faithfully not enforced.

Transactions on Back4app

Back4app is an open-source Backend-as-a-Service (BaaS) platform that combines a managed database, auto-generated REST and GraphQL APIs, authentication, file storage, and Cloud Code serverless functions. Its transactional toolkit matches how apps actually consume ACID: every single-object write is atomic on the underlying document engine, atomic increments and array operations end the classic counter races (the code tabs above), batch saves group writes, and multi-step invariants belong in Cloud Code — validated and executed server-side, where a beforeSave trigger can refuse any write that would break the rules. The decision matrix comes built in: cheap atomicity by default, full coordination where you ask for it.

Frequently asked questions

What does ACID stand for?

Atomicity, Consistency, Isolation, Durability — the four guarantees a database transaction must give for data to stay correct through errors, crashes, and concurrent users. Jim Gray defined the core properties in 1981; Theo Härder and Andreas Reuter coined the acronym in their 1983 paper on transaction-oriented recovery.

What is an ACID transaction in simple terms?

A group of reads and writes executed as one all-or-nothing unit. Either every operation commits and becomes permanent, or every operation rolls back as if nothing happened. The canonical example is a money transfer: debit one account, credit another — a crash between the two must never leave the money debited but not credited.

What are isolation levels?

The dial that trades performance for protection when transactions run concurrently. The SQL standard defines four — read uncommitted, read committed, repeatable read, serializable — each preventing more anomalies (dirty reads, non-repeatable reads, phantoms) at more cost. In practice most modern engines default to snapshot-style isolation via MVCC, where readers see a consistent snapshot and never block writers.

What is the difference between ACID and BASE?

Two answers to the cost of correctness. ACID pays in coordination to guarantee every transaction sees and leaves a valid state. BASE — Basically Available, Soft state, Eventually consistent — pays in temporary staleness to stay available and scale horizontally. Neither is superior; they price consistency differently, and real systems mix them per workload.

Is consistency in ACID the same as consistency in the CAP theorem?

No — and conflating them is the most common confusion on this topic. ACID consistency means every transaction preserves the declared rules: constraints hold, invariants survive. CAP consistency means every node in a distributed system sees the same data at the same time. A single-node database can be fully ACID while CAP has nothing to say about it.

Are NoSQL databases ACID compliant?

Increasingly, with fine print. Document databases have always made single-document writes atomic — which, combined with embedding related data, covers most app needs. Multi-document ACID transactions arrived in MongoDB 4.0 (2018) with snapshot isolation, at a real performance cost. The old "NoSQL means no transactions" claim is now simply outdated; the design preference for modeling around single-document atomicity is not.

How do databases actually implement ACID?

Three mechanisms carry the load: undo information makes rollback possible (atomicity); write-ahead logging — changes recorded to a durable log before being applied — survives crashes (durability); and either locking or MVCC keeps concurrent transactions out of each other's way (isolation). Consistency is the outcome: constraints checked inside the protection of the other three.

When is eventual consistency good enough?

When a brief window of staleness costs nothing: like counts, view counters, activity feeds, analytics, caches, product recommendations. When it is not: money, inventory that can oversell, seat and ticket booking, anything regulated. The engineering skill is not choosing a side but routing each write to the guarantee it actually needs.

Related terms

Compare with

Further reading

Ready to build your backend?

Start your project on Back4app in minutes — database, auth, APIs, and Cloud Code included. No credit card required.

Written and reviewed by Back4app Engineering, Back4app Engineering · Published 2026-07-26