Skip to main content

What does consistency mean?

Consistency is a transaction property meaning that before and after it runs, the data must be in a correct, non-contradictory state, one that follows the system's rules: constraints, schemas, validations, uniqueness, referential integrity, and business logic.

What this guarantees

  • a transaction can't save data that violates the rules (e.g. a unique index or a foreign key)
  • the system moves from one consistent state to another consistent state
  • the data can't be "broken" even by failures partway through the process (together with Atomicity)

An example

There's a rule: an account balance can't go negative. If a transaction tries to withdraw more than the account holds, it won't be committed, because that would break consistency.

In SQL, this might be enforced by:

  • CHECK constraints
  • UNIQUE
  • FOREIGN KEY
  • triggers
  • business-logic validators

In one sentence

Consistency = "after a transaction, the data must stay logically correct and not violate the system's integrity rules".

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.