Skip to content
Ameen Abozaid
Planned lessonMID-018-L04

Replication and read replicas

  • Lesson 4 of 6
  • Mid-level
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 DELETE replicates too.
Draft outline details

Demonstration

sql
-- 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.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.