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
Publicationchapter of logical replicationSubscriptionwhat a subscriber applies, including a logical replication slotRow FiltersandColumn Listschapters of the same pageConflictsandQuick Setupfurther 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
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.
License: CC-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.
Cite this
iinventedlight. 2026. "PostgreSQL logical replication copies row changes, not disk blocks." iinventedlight Library, iil:note:cfmm522g, version of 2026-11-20. https://iinventedlight.com/library/notes/postgres-logical-replication/. License: CC-BY-4.0.
@misc{iil_note_cfmm522g,
author = {{iinventedlight}},
title = {{PostgreSQL logical replication copies row changes, not disk blocks}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-20},
url = {https://iinventedlight.com/library/notes/postgres-logical-replication/},
note = {Permanent ID iil:note:cfmm522g. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- postgres-logical-replication.table.json (table; CC-BY-4.0)
- postgres-logical-replication.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/postgres-logical-replication.md.