ACID for Database
For those dabbling with #databases, #ACID properties are common knowledge. Almost every bank transaction is supposed to maintain this basic standard (and more actually). ACID is an acronym for Atomicity, Consistency, Isolation and Durability.
To understand what #Atomicity is: When you transfer, let’s say Rs 1000, from your account to another account, it has to happen as a whole or not happen at all. You cannot have money debited from your account alone and not credited to the other account. That’s what atomicity is.
For the same money transfer transaction as above, #Consistency means that the net balance in both accounts is correct whether it went through successfully or not. For example, if you had Rs 10000 to start with, after a failed transaction, the account balance has to be the same.
#Isolation comes into the picture usually in cases of multiple transactions.
Transaction 1: X is transferring Rs 1000 to Y
Transaction 2: Z is transferring Rs 500 to X.
Whether Transaction 1 happens successfully or not, Transaction 2 can happen independently.
Sometimes you might have seen an account-to-account transfer initiated but then your internet connection is lost or there is a failure on the bank server. When you log back in later, the system shows the account balance properly. That is what is called #Durability.
When there are multiple transactions happening in large volumes across many accounts, there are of course cases where the ACID properties may not be maintained. And something called BASE is considered at those times — that’s for a later post though.