Replication and read replicas
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
understand streaming replication and its lag.
Planned topics
- Streaming replication ships WAL from the primary to standbys, which replay it continuously.
- Standbys can serve read-only queries (read replicas) and can be promoted on failure.
- Asynchronous replication can lag; synchronous replication waits for the standby but adds write latency.
- Reading your own write from a lagging replica returns stale data; route such reads to the primary or wait for the LSN.
- Replication is not a backup: a bad
DELETEreplicates too.
Draft outline details
Demonstration
-- on primary
SELECT client_addr, state, replay_lag FROM pg_stat_replication;Check your understanding
Does a replica protect against an accidental DROP TABLE?
Show answer
No; the change replicates.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.