What is the difference between integrity and consistency?

I think the difference is that the two terms refer to different things:

  • Consistency refers to Transactions (it's the C in ACID).

  • Integrity refers to Databases.

A transaction is said to be consistent if it keeps the integrity of the database (i.e. if it transforms the database from a valid state to another valid state).


CAP and ACID are discussing different things, though both use the C for Consistency.

Read John Huggs's post: https://www.voltdb.com/blog/disambiguating-acid-and-cap

ACID is defining what it takes to make a what is normally described as making a "true transaction" fulfilling the ACID goals. In actuality, it seems that the C for Consistency is more for the acronym than defining any real consistency rules. The transaction is what defines the boundary of consistency.

CAP is for distributed systems and promises that every replica of the same logical value, spread across nodes in a distributed system, has the same exact value at all times.

However, because of the latency issues with distributed systems CAP does not necessarily define which latest logical value is persisted.

Therefore, Consistency in CAP means every read receives either (1) the most recent write or else (2) an error.

See also the accepted answer by RolandoMySQLDBA (January 2013) at: Consistency in ACID and CAP theorem, are they the same?

The synopsis on this brief answer differentiates as follows:

  • ACID addresses an individual node's data consistency
  • CAP addresses cluster-wide data consistency

Addressing the two terms:

Integrity - Conformity in the application of something for the sake of logic, accuracy, or fairness.

Consistency - Not containing any logical contradictions.