{
  "slug": "write-ahead-log",
  "term": "Write-ahead log",
  "aliases": [
    "WAL"
  ],
  "definition": "A write-ahead log is a recovery log whose relevant records must become durable before the corresponding changes are persisted in database data files.",
  "note": "Write-ahead logging names the ordering protocol; the write-ahead log is its record stream. PostgreSQL can replay logged changes after a crash, so committing a transaction need not flush every modified data page. A record in a memory buffer is not yet a durable record.",
  "status": "shipping",
  "advantages": [
    {
      "text": "Allows changed data pages to be written later while preserving logged recovery information.",
      "citationIds": [
        "pg-intro"
      ]
    }
  ],
  "limitations": [
    {
      "text": "Recovery still depends on storage honoring synchronization requests.",
      "citationIds": [
        "pg-reliability"
      ]
    }
  ],
  "related": [
    "database-checkpoint",
    "full-page-write",
    "fsync",
    "persistence-ordering",
    "crash-consistency",
    "log-sequence-number"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "citations": [
    {
      "id": "pg-intro",
      "title": "PostgreSQL 18: Write-Ahead Logging",
      "url": "https://www.postgresql.org/docs/18/wal-intro.html",
      "accessed": "2026-10-11"
    },
    {
      "id": "pg-reliability",
      "title": "PostgreSQL 18: Reliability",
      "url": "https://www.postgresql.org/docs/18/wal-reliability.html",
      "accessed": "2026-10-11"
    },
    {
      "id": "hesela-wal",
      "title": "WAL, checkpoints and torn pages: three different recovery guarantees",
      "url": "https://hesela.com/analyses/wal-checkpoints-torn-pages/",
      "accessed": "2026-10-11"
    }
  ],
  "updated": "2026-10-12"
}
