{
  "slug": "log-sequence-number",
  "term": "Log sequence number",
  "aliases": [
    "LSN"
  ],
  "definition": "A log sequence number identifies a position in an engine's ordered recovery-log address space.",
  "note": "PostgreSQL represents an LSN as a byte offset in WAL. Insert, write and durable-flush positions have different meanings: knowing an LSN does not establish that its record is durable. Subtracting compatible positions gives bytes, not transaction count or elapsed time; retain the engine, timeline and observed progress stage when comparing positions.",
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "related": [
    "write-ahead-log",
    "database-checkpoint",
    "replication-lag",
    "synchronous-replication",
    "asynchronous-replication"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "citations": [
    {
      "id": "pg-internals",
      "title": "PostgreSQL 18: WAL Internals",
      "url": "https://www.postgresql.org/docs/18/wal-internals.html",
      "accessed": "2026-10-12"
    },
    {
      "id": "pg-functions",
      "title": "PostgreSQL 18: Backup Control Functions, Table 9.97 and notes",
      "url": "https://www.postgresql.org/docs/18/functions-admin.html#FUNCTIONS-ADMIN-BACKUP",
      "accessed": "2026-10-12"
    },
    {
      "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-12"
    },
    {
      "id": "pg-lsn",
      "title": "PostgreSQL 18: pg_lsn type",
      "url": "https://www.postgresql.org/docs/18/datatype-pg-lsn.html",
      "accessed": "2026-10-12"
    },
    {
      "id": "pg-timelines",
      "title": "PostgreSQL 18: timeline history and recovery branches",
      "url": "https://www.postgresql.org/docs/18/continuous-archiving.html#BACKUP-TIMELINES",
      "accessed": "2026-10-12"
    },
    {
      "id": "hesela-replication",
      "title": "Replication acknowledgements: received, durable, applied",
      "url": "https://hesela.com/analyses/replication-acknowledgements-durability-lag/",
      "accessed": "2026-10-12"
    }
  ],
  "updated": "2026-10-12"
}
