PostgreSQL Streaming Replication
Cheat sheet · https://pcornel.dk/topic.php?topic=6187
Answer
PostgreSQL streaming replication sends WAL from the primary to standbys over a replication connection; standbys replay it and can serve read-only queries.
Remember
Use replication slots carefully (they retain WAL). Monitor lag in bytes and time. Synchronous standbys block commits if they are down.
First checks
SELECT client_addr,state,sent_lsn,replay_lsn FROM pg_stat_replication;— first check for this topicpsql -c "SELECT now(), version();"— PostgreSQL reachable and versionmysql -e "SELECT NOW(), VERSION();"— MariaDB/MySQL reachable and versionsqlcmd -S <server> -Q "SELECT @@VERSION"— SQL Server reachable and version
Verify in this order
primary WAL → walsender → walreceiver → replay on standby
Where it usually breaks
Without a slot or enough wal_keep_size, a lagging standby can fall behind permanently.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6187