---
source: https://iinventedlight.com/library/notes/postgres-logical-replication.md
title: "PostgreSQL logical replication copies row changes, not disk blocks"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PostgreSQL License (PostgreSQL Global Development Group); PostgreSQL License (PostgreSQL Global Development Group); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: PostgreSQL Global Development Group, Logical Replication; PostgreSQL Global Development Group, logical.c. PostgreSQL License; PostgreSQL License."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-20
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-20
as_of: 2026-11-20
confidence: medium
untested: "Not reproduced (2026-11-20). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: PostgreSQL logical replication"
tags: [postgresql, replication, databases]
client: Librarian
sources:
  - id: S1
    title: "Logical Replication"
    publisher: PostgreSQL Global Development Group
    url: https://www.postgresql.org/docs/current/logical-replication.html
    accessed: 2026-11-20
    license: "PostgreSQL License"
  - id: S2
    title: "logical.c"
    publisher: PostgreSQL Global Development Group
    url: https://raw.githubusercontent.com/postgres/postgres/master/src/backend/replication/logical/logical.c
    accessed: 2026-11-20
    license: "PostgreSQL License"
---
# PostgreSQL logical replication copies row changes, not disk blocks
**Answer:** Logical replication is a method of replicating data objects and their changes, based upon a replication identity (usually a primary key). The name contrasts with physical replication, which copies exact block addresses byte by byte. PostgreSQL supports both mechanisms concurrently.

## Publications, subscriptions, and more

- `Publication` chapter of logical replication
- `Subscription` what a subscriber applies, including a logical replication slot
- `Row Filters` and `Column Lists` chapters of the same page
- `Conflicts` and `Quick Setup` further chapters in the same page

The table of contents also covers generated column replication, replicating sequences, failover, architecture, monitoring, and configuration settings for publishers and subscribers.

## Decoding contexts

logical.c provides PostgreSQL logical decoding coordination. The file coordinates interaction between the various modules that together provide logical decoding, primarily by providing LogicalDecodingContexts. Its goal is to hide most of the internal complexity from consumers of logical decoding, so they can create and consume a changestream with little code. Builtin consumers are the walsender and SQL SRF interface, yet further ones can be added without changing core code, e.g. to consume changes in a bgworker. A consumer provides callbacks, including one to read WAL.

## See also

- [postgres-partitioning](https://iinventedlight.com/library/notes/postgres-partitioning/)
- [postgres-listen-notify](https://iinventedlight.com/library/notes/postgres-listen-notify/)
- [postgres-transactions](https://iinventedlight.com/library/notes/postgres-transactions/)

## Claims

- id: C1
  claim: Logical replication copies data objects and their changes according to a replication identity, usually a primary key.
  source: S1
  evidence: "based upon their replication identity (usually a primary key)."

- id: C2
  claim: Physical replication, by contrast, copies exact block addresses byte-by-byte.
  source: S1
  evidence: "physical replication, which uses exact block addresses and byte-by-byte replication."

- id: C3
  claim: logical.c coordinates logical decoding through LogicalDecodingContexts so consumers can build a changestream with little code.
  source: S2
  evidence: "create and consume a changestream with a low amount of code."

## Sources

- [S1] Logical Replication. PostgreSQL Global Development Group. https://www.postgresql.org/docs/current/logical-replication.html . License: PostgreSQL License. Accessed 2026-11-20.

- [S2] logical.c. PostgreSQL Global Development Group. https://raw.githubusercontent.com/postgres/postgres/master/src/backend/replication/logical/logical.c . License: PostgreSQL License. Accessed 2026-11-20.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: PostgreSQL Global Development Group, Logical Replication; PostgreSQL Global Development Group, logical.c. PostgreSQL License; PostgreSQL License. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
