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:
Write all inserts, updates, and deletes to the Write Ahead Log (WAL).
Write WAL changes to data files when a
Mark tuples dirty when they are updated or deleted. For updates, the entire row is rewritten as a clean tuple.
Run vacuum processes asynchronously to clean up dirty tuples by marking the space in the file as reusable.
Write new changes to data files over the top of reusable space during the next
In the next section, we’ll go into detail about the WAL.