9

Whether I read about CAP or ACID, I see that consistency is referred to ensure the DB integrity constraints. So, I do not understand, why two terms are used to refer the same thing or there is a difference between the integrity and consistency?

I read that

Anyhow, Atomic, Consistent, Isolated, Durable are properties of the transactions. It is true that atomicity + isolation is enough for you to roll-your-own consistency. But we can also roll our own atomicity, roll our own isolation, and roll our own persistence (durability). When we roll our own, we must pay for features with our own blood, sweat, and parentheses. We don't say the properties were given to us by a transaction system.

which suggests that consistency is what user application can provide himself on top of database integrity constraints. This is not property that is provided by database, as AID properties are. Why to give C the title as you do to the other, system-provided AID properties?

2 Answers 2

7

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).

1
  • Wait, in Serializability, I read that Serializability is used to keep the data in the data item in a consistent state. If you are right, they should tell consistency is used to maintain the integrity/correctness, isn't it? They seem to apply the consistency property to the DB, instead of the transaction. So, we should be able to speak about DB consistency as well. It must be identical to integrity then, right? Dec 5, 2016 at 13:28
6

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.