Consistency
- A transaction moves the database from one valid state to another — it cannot violate database-defined constraints (
primary keys,foreign keys,check constraints,triggers,unique columns) -
If a transaction would leave the database in an invalid state, it is aborted
-
This is the application-level ACID property: the database enforces the rules, but the application defines what "valid" means via schema and constraints
- So the application still can hurt this guarantee even with the database saying it's fine
- E.g., a bank transfer transaction with only the debit statement (the developer forgot the credit line)
C (Consistency) is widely regarded as the weak letter. Härder and Reuter coined ACID in 1983, and the C was arguably included to make the acronym pronounceable. The common critique — you'll hear it from Hellerstein and in Kleppmann's DDIA — is that consistency isn't a property the database provides at all. Constraint checking is real but narrow, and everything beyond it is the application's responsibility.