Single master/primary + one or multiple slaves/replicas/standby • Replicates full database: ◦ Byte by byte ◦ Including users, DDL, sequences ◦ Excluding configuration files (postgres.conf, pg_hba.conf) • Asynchronous (default) or synchronous • Less overhead/pressure on master • Based on Write Ahead Log (WAL) PostgreSQL Replication
recycling on primary ◦ When replica cannot catch up or lost connection for too long ➢ Continuous archiving • Query conflicts ◦ When application of WAL conflicts with long running query ➢ hot_standby_feedback, max_standby_streaming_delay • Many configuration options PostgreSQL Replication
Based on logical decoding (since 9.4, pglogical, BDR) • Publish/subscribe model with initial snapshot • Independent versions between publisher and subscriber • Flexible ◦ Partial data replication possible, e.g. only particular tables ◦ Multiple source DBs into one target DB • DDL changes and sequences are not replicated => conflicts and errors PostgreSQL Replication
Continuous archiving + streaming replication + use replication slots ◦ If hot standby: no hot_standby_feedback, low max_standby_streaming_delay • Read replica for data analysis: ◦ File based log shipping and high max_standby_archive_delay ◦ Streaming replication and high max_standby_streaming_delay ◦ Logical replication • Write scaling ◦ Partitioning/sharding, multi-master: only if writes are mostly conflict free PostgreSQL Replication