Reference · Cheat sheet

Replication

Lesson 0010 distilled — streaming vs logical, async vs sync, and the MySQL binlog contrast. Built to print.

From lesson 0010Context: PostgreSQL current

The idea

The WAL is an ordered stream of every change (0009). Ship it to another server → a replica. Two ways: copy the bytes or the meaning.

Streaming / physical (default)

Standby continuously receives & replays the primary's WAL recordsbyte-for-byte whole-cluster clone, same version, read-only hot standby. The HA backbone.

Async vs sync

Async (default): WAL shipped after commit → standby lags → a primary crash loses un-shipped commits on failover.

Sync (synchronous_standby_names): commit waits for the standby's WAL flush → no loss, but a standby outage can hang commits. = synchronous_commit over the network.

Logical (pub/sub)

Ships row-level changes by replication identity (usually the PK), not bytes. Publisher exposes tables; subscribers subscribe.

Enables: subset of tables, cross major version, cross-platform, writable target. Higher-level → more rules/limits.

Postgres vs MySQL

AspectMySQLPostgres
Default shipsbinlog (logical)WAL (physical)
binlog's cousinlogical repl
No-losssemi-syncsync repl
Async risklose binloglose WAL

Inspect it

SELECT * FROM pg_stat_replication;state, sync_state, replay_lag (the async loss window).

SHOW synchronous_standby_names; — empty = all async.