Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

What Is ACID in Databases? The Four Transaction Properties

Use a transfer example to understand atomicity, consistency, isolation, and durability, and see what those guarantees mean in practice.

Table of Contents

ACID describes four properties of database transactions: atomicity, consistency, isolation, and durability. Together they describe what happens when several changes must succeed as one unit, when transactions overlap, and when the database restarts after a failure.

What is ACID? Learn about 4 important properties in databases Picture 1
ACID describes four distinct properties of a database transaction.

The four ACID properties with a transfer example

PropertyWhat it meansExample
AtomicityThe transaction commits as a unit or its effects are rolled back.The debit and credit both commit. A failure before commit leaves neither change in place.
ConsistencyA successful transaction preserves the rules the system enforces.A check constraint rejects a balance below the allowed minimum. The application must still choose the correct account and amount.
IsolationThe isolation level determines how concurrent transactions can observe or affect one another.Two transfers from the same account cannot safely rely on the same old balance without appropriate concurrency control.
DurabilityA committed transaction survives failures covered by the database’s durability guarantees.After a crash and recovery, a transfer the database durably committed is still present.

Put the guarantee in the right place

Put related database writes between BEGIN and COMMIT. Check the input and affected rows before committing, and roll back on failure. Use constraints for rules the database can enforce, such as unique IDs and foreign keys. A message sent to an outside service is a separate effect unless you design a way to coordinate it with the transaction.

The usual SQL isolation level names are Read Uncommitted, Read Committed, Repeatable Read, and Serializable. The details vary by database. Serializable aims for the results of some one-at-a-time ordering and may reject a transaction that must be retried. See PostgreSQL’s isolation guide for a concrete implementation.

Durability depends on storage and configuration. For example, an asynchronous commit mode can have different recovery guarantees. Backups still matter for accidental deletion or storage loss.

ACID and eventual consistency can coexist

What is ACID? Learn about 4 important properties in databases Picture 2
BASE is associated with eventual consistency in distributed systems.

An order can commit in one database while a separate search index updates later. The order’s transaction and the delay before it appears in search describe different parts of the system. A pattern such as CQRS separates read and write responsibilities and does not determine the guarantees by itself.

Try the SQL learning path for transaction practice, then use the database practices lab to test what happens when a transaction boundary or constraint is wrong.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.