Same invariant. Who guards it: the database or your code?
ACID: one transaction, all-or-nothing and isolated. BASE: small local commits, events in between, and retries, compensations and reconciliation to repair the gaps.
A PostgreSQL primary with async read replicas. ACID or BASE?
Two axes
Both. Transactions keep invariants true (ACID’s C); replicas converge later (BASE’s E). Different promises, independent axes.
+43 min
extra downtime a month for a two-database commit
Two-phase commit needs both up: 99.9% × 99.9% ≈ 99.8%. Chain five and it’s about 3.6 hours. Pritchett’s eBay answer: split data by function, shard each.
The same sale, BASE-style: commit locally, publish, apply once
Sale and outbox row commit together. A relay publishes at least once; the consumer adds 640 only for a new sale ID.
So is BASE just NoSQL?
Bad: SQL is ACID, NoSQL is BASE
DynamoDB and MongoDB have transactions; PostgreSQL shops run sagas.
Good: Label the operation
Ask which invariant must hold, and how stale each read may be.
Order biryani: what must be atomic, what can lag?
Order state, payment and ledger lines commit together. Restaurant, rider and push follow as outbox events, retried and de-duplicated.
You paid. The restaurant never accepts. Now what?
- C1, one local commit: cancel, reverse, request refund
- C2: refund with its own idempotency key, retried with backoff
- Until it settles, the app shows “refund initiated”
Remember
ACID and BASE are about who guards invariants. Choose per feature: a small ACID core for money and scarce stock; BASE edges, retried and idempotent, for the rest.