10 min read Part 6 of 10

Part 6: Transactions & Consistency

ACID isn't just a buzzword. How CockroachDB guarantees serializable isolation.

CockroachDB Transactions ACID
Part 6: Transactions & Consistency

Most NoSQL databases sacrifice consistency for scale. CockroachDB refuses to compromise. It gives you both.

Serializable Isolation

In the database world, “Serializable” is the gold standard. It means the database behaves as if transactions were executed one after another, even if they actually ran in parallel.

CockroachDB runs at Serializable Isolation by default. You cannot lower it. This means you never have to worry about:

  • Dirty Reads
  • Non-repeatable Reads
  • Phantom Reads

Time Travel Queries

Because CockroachDB uses Multi-Version Concurrency Control (MVCC), it keeps old versions of your data for a configurable amount of time (default 25 hours).

You can query the database as it existed in the past!

SELECT * FROM users AS OF SYSTEM TIME '-10m';

This is incredibly useful for debugging or generating consistent reports without locking tables.

Conclusion

Strong consistency makes building applications much easier. You don’t have to handle weird race conditions in your code. But consistency comes at a cost: performance. Let’s tune it.

Tags: CockroachDB Transactions ACID
← Back to Blog