今日已更新 328 条资讯 | 累计 20300 条内容
关于我们

ACID vs BASE: What Database Guarantees Actually Promise

pickuma 2026年06月04日 14:57 6 次阅读 来源:Dev.to

When people say a database is "ACID-compliant" or "eventually consistent," they are making promises about what happens when things go wrong — concurrent writes, crashes, network failures. ACID and BASE are the two vocabularies for those promises, and knowing the difference tells you what you can and cannot rely on. What ACID guarantees ACID is the contract that traditional transactional databases — PostgreSQL, MySQL/InnoDB, Oracle, SQLite — make about a transaction (a group of operations treated as one unit). The four letters: Atomicity : the whole transaction succeeds or none of it does. If a bank transfer debits one account but the credit fails, the debit is rolled back. There is no half-done state. Consistency : a committed transaction moves the database from one valid state to another, never violating its declared rules (constraints, foreign keys, types). It will not let you, say, leave a foreign key pointing at a row that does not exist. Isolation : concurrent transactions do not step on each other. The result is as if they ran one at a time, even when they actually ran in parallel. (In practice databases offer tunable isolation levels — from "read committed" to "serializable" — trading strictness for speed.) Durability : once the database says "committed," that data survives a crash or power loss. It has been written somewhere persistent, not just held in memory. The payoff is that you can reason about your data simply: after a successful commit, the world is exactly what you asked for. The cost is coordination, which gets expensive when data is spread across many machines. What BASE trades away BASE is the model many distributed and NoSQL systems adopt — think Cassandra, DynamoDB, or Riak — when they need to scale across many nodes and stay up through failures. The acronym is deliberately a chemistry pun on ACID, and it stands for: Basically Available : the system answers requests even during partial failures, possibly with stale or incomplete data rather tha

本文内容来源于互联网,版权归原作者所有
查看原文