Replication Basics
Learning Focus
Use this lesson to understand PostgreSQL replication at a conceptual level and avoid treating replication as a backup.
Concept Overview
Replication improves availability and read scaling.
Two broad types:
- physical (streaming) replication: WAL-based, byte-level
- logical replication: statement/row-level publication/subscription
Replication is not a backup. It can replicate corruption and accidental deletes.
Key Concepts
| Concept | Meaning |
|---|---|
| primary | source server |
| replica/standby | receives changes |
| replication slot | retains WAL until consumer confirms |
Best Practices
- Combine replication with independent backups.
- Monitor replication lag.
- Test failover and promotion in a sandbox.
Quick Reference
physical replication = WAL streaming
logical replication = publications/subscriptions
replication != backup
Completion
You have reached the final module. Revisit performance, security, and backup modules regularly as your system and data volume grow.