{
  "slug": "replication-lag",
  "term": "Replication lag",
  "aliases": [],
  "definition": "Replication lag is a difference in replication progress between a source and a replica, measured at a named processing stage in a stated unit.",
  "note": "Separate byte backlog from measured delay and identify receipt, write, flush or replay. PostgreSQL 18 pg_stat_replication lag intervals describe recent processing and notification delays, not a catch-up-time estimate. An idle caught-up standby can report NULL; NULL can also indicate missing tracking information, so it must not be replaced unconditionally with zero.",
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "related": [
    "synchronous-replication",
    "asynchronous-replication",
    "log-sequence-number",
    "latency-storage"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-12",
  "citations": [
    {
      "id": "pg-stats",
      "title": "PostgreSQL 18: pg_stat_replication and lag semantics",
      "url": "https://www.postgresql.org/docs/18/monitoring-stats.html#MONITORING-PG-STAT-REPLICATION-VIEW",
      "accessed": "2026-10-12"
    },
    {
      "id": "pg-functions",
      "title": "PostgreSQL 18: WAL and recovery information functions",
      "url": "https://www.postgresql.org/docs/18/functions-admin.html",
      "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"
    }
  ]
}
