I was asked about ACID term recently and I was a little confused because I don’t use this term on a daily basis. As a backend developer I use database transactions a lot, but ACID term was pretty new for me.
ACID is an acronym formed from the initial letters of 4 words:
And you know what? Database transaction has all of these properties.
Atomicity guarantees that all statements in transaction are being treated as a single unit. All or none of them are committed and in case of a problem with individual statement, database state isn’t changed.
Consistency means that data produced within transaction was validated against defined rules, constraints etc.
In case of concurrency Isolation allows to run many transactions at the same time, but without knowing state or operations performed within parallel transactions. Operating on data policy is defined by database isolation level (to be described in the next post).
Durability ensures that data committed by transaction will be persisted in database.
Above set of properties gathered together in 1983 by Andreas Reuter and Theo Härder guarantees data validity despite any possible errors (including power failures 😉 ).