ACID Compliance

Postgres is ACID compliant, which stands for Atomicity, Consistency, Isolation, and Durability. What this means is that, in case of system failure, Postgres won’t lose or miscommunicate data, even if there are many changes made in a single transaction.

To achieve this, it will:

  1. Write all inserts, updates, and deletes to the Write Ahead Log (WAL).

  2. Write WAL changes to data files when a CHECKPOINT occurs.

  3. Mark tuples dirty when they are updated or deleted. For updates, the entire row is rewritten as a clean tuple.

  4. Run vacuum processes asynchronously to clean up dirty tuples by marking the space in the file as reusable.

  5. Write new changes to data files over the top of reusable space during the next CHECKPOINT.

In the next section, we’ll go into detail about the WAL.