Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is C in CAP theorem not same as C in ACID?

Tags:

nosql

My question is pretty simple, was looking for a simpler answer, Why is C in CAP theorem not same as C in ACID?

Read this HN thread.

Update

A Hitchhiker's Guide to NOSQL v1.0, slide 71 says: C in CAP = A+C (Atomic Consistency)

like image 458
zengr Avatar asked Jan 27 '11 06:01

zengr


People also ask

Does C in CAP and ACID mean the same?

Next, while the “C” in the CAP Theorem refers to each node in the system having the same data, the “C” in ACID refers to a single node enforcing the same rules on every potential commit, such as the type of a field or a field not being null.

How is CAP theorem different from ACID properties?

In CAP, the term consistency refers to the consistency of the values in different copies of the same data item in a replicated distributed system. In ACID, it refers to the fact that a transaction will not violate the integrity constraints specified on the database schema.

How is CAP consistency is different from acid consistency?

Consistency in CAP is different than that of ACID. Consistency in CAP means having the most up-to-date information. (ACID refers to a different database event. In ACID, consistency means any new transaction to the database won't corrupt the database.)

What does C mean in CAP theorem?

The CAP theorem (also called Brewer's theorem) states that a distributed database system can only guarantee two out of these three characteristics: Consistency, Availability, and Partition Tolerance.


2 Answers

Both C's stand for consistency, but the notion of consistency in CAP means that "all nodes see the same data at the same time" and the notion of consistency in ACID means that "any transaction the database performs will take it from one consistent state to another". (From Wikipedia.)

like image 194
Felix Dombek Avatar answered Sep 22 '22 04:09

Felix Dombek


You cannot hardly have meaningful consistency without atomicity. This is why the CAP theorem defines the C in the way that it does.

Imagine this simple scenario:

There is a database with two accounts. There is no money coming in our out of the database. Just the money on the two accounts. In the database, money is moved between one account to another.

Without atomicity, the user could read the data when money has been deducted from one account while it has not yet been written to the other. In this case, the grand total of the two accounts would vary from read to read, something that should be impossible as "new" money is not leaving or entering the database.

To talk about consistency in any other way is like thinking about a Java boolean as being "nearly" true while the rest of the world reads it as false.

like image 33
Jack Wester Avatar answered Sep 21 '22 04:09

Jack Wester