DEV Community

Cover image for What is ACID?
Sparky-code
Sparky-code

Posted on

What is ACID?

ACID is an acronym that stands for Atomicity, Consistency, Isolation, and Durability. It is a set of properties that guarantee reliable and consistent transactions in a database management system. ACID ensures that a database transaction is processed in a reliable and predictable way, even in the presence of system failures or concurrent access by multiple users.

Atomicity means the property of a transaction is treated as a single, indivisible unit of work. It means that either all the operations in the transaction are completed successfully, or none of them are. If any operation in the transaction fails, the entire transaction is rolled back, and the database is left in its original state.

Consistency means that a transaction brings the database from one valid state to another valid state. This means that the transaction should preserve the integrity of the data and ensure that all constraints, rules, and relationships are maintained throughout the transaction.

Isolation means that multiple transactions can execute concurrently without interfering with each other. Each transaction must be executed as if it is the only transaction being executed at that moment. This is achieved through a variety of concurrency control techniques, such as locking and transaction isolation levels.

Durability means that once a transaction has been committed, its changes are permanent and will survive any subsequent system failures, such as power outages or hardware failures. This is achieved through techniques such as write-ahead logging and transaction checkpoints.

By providing atomicity, consistency, isolation, and durability, ACID transactions guarantee that the database will be left in a valid and reliable state, even when things don't go according to plan.

Top comments (0)