Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Secret Decoder Ring for Postgres Replication:...

A Secret Decoder Ring for Postgres Replication: A Beginner’s Guide | Claire Giordano | Postgres Summit US 2026

Slides from a conference talk at Postgres Summit US 2026 in New York City. Abstract: If you’re new to Postgres, replication can feel like alphabet soup: logical, physical, streaming, synchronous, asynchronous—and that’s just the core features.

This is the replication primer I wish I’d had when I first started working with Postgres. In this talk, we’ll break down the main types of replication—what’s actually different about them, how they work, and when you’d choose one over another. Expect diagrams, analogies, and zero sub-bullets as we map replication concepts to mental models you already know.

We’ll connect each approach to real-world use cases: high availability (HA), disaster recovery (DR), scaling reads, and migrations. Along the way, we’ll demystify WAL (the write-ahead log) and touch on how HA setups like Patroni fit into the picture.

If you’ve ever nodded along in a replication conversation while quietly looking up terms under the table, this talk is for you.

Avatar for Claire Giordano

Claire Giordano

October 02, 2026

More Decks by Claire Giordano

Other Decks in Technology

Transcript

  1. Developer Eng Manager PM Marketer Writer Open-source champ Community Lead

    Podcaster @clairegiordano @clairegiordano.bsky.social PGCA Board POSETTE: An Event for Postgres
  2. Azure Database for PostgreSQL How my work fits into… Microsoft’s

    contributions to the Postgres ecosystem POSETTE: An Event for Postgres Visual Studio Code Extension Supporting Postgres Events Azure HorizonDB Talking Postgres podcast Microsoft Blog for PostgreSQL Upstream Contributions to Postgres
  3. Why this beginner’s guide? Because even experienced users sometimes get

    confused with our replication terminology…. ...
  4. This Beginner Guide has _8_ chapters 6 Why replicate? Words

    you’ll hear It all starts with WAL What gets copied? How does it get there? Does the commit wait? Secret Decoder Ring But what about Cloud architectures?
  5. Chapter 1 7 Why replicate? Words you’ll hear It all

    starts with WAL What gets copied? How does it get there? Does the commit wait? Secret Decoder Ring But what about Cloud architectures?
  6. Pain point addressed by Replication: HA “My database server failed

    & my application needs to keep running” 8 High Availability
  7. Also addressed by Replication: DR “We lost our database environment

    & need to recover—the whole site is gone!” 9 Disaster Recovery
  8. Need to offload reads to another server? “Our read workload

    is crushing the database— everything is so slow” 10 Read Scaling
  9. What if you need to migrate & cannot be down

    for hours? “We need to move (or upgrade) and we can’t afford a long outage” 11 Migrations & Upgrades
  10. Who else needs their own copy of the data? “Our

    analytics team is always working off yesterday’s numbers” 12 Data Sharing
  11. 5 Pain Points that Replication helps with 13 “My database

    server failed & my application needs to keep running” High Availability “We lost our database environment & need to recover—the whole site is gone!” Disaster Recovery “Our read workload is crushing the database— everything is so slow” Read Scaling “We need to move (or upgrade) and we can’t afford a long outage” Migrations & Upgrades “Our analytics team is always working off yesterday’s numbers” Data Sharing
  12. Yes, if goal is to get back online No, if

    you want to recover from mistakes
  13. Chapter 2 16 Why replicate? Words you’ll hear It all

    starts with WAL What gets copied? How does it get there? Does the commit wait? Secret Decoder Ring But what about Cloud architectures?
  14. You’ll learn 25 terms in the next 45 minutes •

    WAL • physical replication • logical replication • streaming • log shipping • synchronous • asynchronous • WAL replay • crash recovery • PITR • base backup • logical decoding • publisher & subscriber • CDC • replication slots • replication lag • read replica • RPO • RTO • HA • DR • primary • standby • failover • Patroni
  15. Chapter 3 18 Why replicate? Words you’ll hear It all

    starts with WAL What gets copied? How does it get there? Does the commit wait? Secret Decoder Ring But what about Cloud architectures?
  16. WAL analogy WAL is like a waiter’s notepad Write it

    down BEFORE sending to kitchen → write-ahead As you take new orders → write them down too If someone changes their order → write it down too (& send change to kitchen!)
  17. WAL is NOT ONLY for replication! Also used by: Crash

    recovery A server with no replicas replays its own WAL on restart PITR PITR uses WAL to get you back to right before the mistake (assuming you were archiving WAL) (point in time recovery) 21
  18. Chapter 4 22 Why replicate? Words you’ll hear It all

    starts with WAL What gets copied? How does it get there? Does the commit wait? Secret Decoder Ring But what about Cloud architectures?
  19. PHYSICAL Replication analogy Copying a house “brick by brick” Start

    with a base backup to copy the house identically. Every item in the same position, in the same room. Then keep it the same—as the primary house changes, send the same changes to the replicated brick house.
  20. Because PHYSICAL replication is byte-level... PRIMARY 1. Both primary &

    standby need same major version 2. It’s always the entire server—not a subset of tables 3. The standby is read only! No extra tables, no different indexes STANDBY
  21. LOGICAL Replication analogy Copying the furniture, not the house Downsizing

    to a second smaller flat in city. Kids have moved out. Fewer rooms & less furniture! Tell the move-in team: sofa in the living room—& no more “children’s rooms”!!
  22. LOGICAL replication has publisher & subscriber —both are full, running

    databases PUBLISHER “pub” SUBSCRIBER “sub” sends changes to the subscriber receives & applies changes to its own tables
  23. LOGICAL is used when subscriber is for a different purpose

    1. Upgrade to new PG major version on subscriber & app keeps running on pub only a subset of 2. Shares tables with another app PUBLISHER 3. Feed separate analytics databases 4. Aggregate multiple databases for analytics SUBSCRIBER
  24. Physical sends WAL. What does Logical send? Logical decoding reads

    WAL on the publisher & turns it into row-level changes. Only decoded changes travel. Subscriber never sees publisher’s WAL. Both Physical & Logical Replication rely on WAL
  25. Logical decoding = also used by CDC tools >> but

    this is NOT considered Postgres replication CDC = “Change Data Capture” Analytics row-level changes Logical decoding happens on source Postgres database (using WAL) CDC tool Kafka Search indexes
  26. About the STANDBY: A Standby cannot write A Subscriber must

    Physical replication Replays WAL & nothing else. A standby is a copy. About the SUBSCRIBER Logical replication Applies changes as real inserts, updates, & deletes. A subscriber is a peer
  27. Standby (speaking to Primary): Physical replication “I’ll replay the WAL

    & make my bytes identical to yours.” Subscriber (speaking to Publisher): Logical replication 32 “Just tell me which tables changed & how. I’ll apply the decoded changes myself.”
  28. Standby (speaking to Primary): Physical replication “I’ll replay the WAL

    & make my bytes identical to yours.” Subscriber (speaking to Publisher): Logical replication 33 “Just tell me which tables changed & how. I’ll apply the decoded changes myself.”
  29. If replication only carries changes—doesn’t a new standby (or subscriber)

    start with nothing? Physical Logical 34 pg_basebackup Copy the whole house —and then replay the WAL CREATE SUBSCRIPTION Copy the rows you chose —and then apply the decoded changes
  30. Chapter 5 35 Why replicate? Words you’ll hear It all

    starts with WAL What gets copied? How does it get there? Does the commit wait? Secret Decoder Ring But what about Cloud architectures?
  31. With PHYSICAL replication, BOTH options are available But with LOGICAL

    replication— Streaming ONLY. No other option. 37
  32. STREAMING vs. LOG SHIPPING analogy Waiter’s notepad (WAL) Yell to

    backup kitchen as you write >> Streaming Tear off finished page & send it >> Log Shipping
  33. Mechanics of Streaming vs. Log Shipping in Physical Replication How

    does STREAMING work? How does LOG SHIPPING work? Standby’s WAL receiver opens connection to primary. Hop 1: Primary copies finished WAL files to an archive (e.g. directory, blob storage) Primary sends WAL as it’s written. Continuous! Standby replays WAL into its data files. 39 Hop 2: Standby fetches WAL files from archive & replays. It’s always behind—the standby never has the WAL file the primary is still writing!
  34. “Replication Slot” is a reservation on WAL It sits on

    primary (or publisher) & advances as standby (or subscriber) confirms Everything before the slot can go. Everything after the slot is kept. 41
  35. Chapter 6 42 Why replicate? Words you’ll hear It all

    starts with WAL What gets copied? How does it get there? Does the commit wait? Secret Decoder Ring But what about Cloud architectures?
  36. When do you get to choose? When are both Asynchronous

    & Synchronous options? 44 Physical replication Streaming Logical replication Log Shipping Asynchronous ONLY
  37. Asynchronous vs. Synchronous analogy in the context of PHYSICAL replication

    Text message receipts Your phone Sent What it means on the standby On its way. Asynchronous: commit doesn’t wait for any receipt. Delivered WAL landed on the standby. Synchronous: commit waits for Delivered receipt. Read Applied and queryable. By default in Postgres, even when synchronous, commit doesn’t wait for Read receipt.
  38. RPO: How much data can you afford to lose? If

    Async is the default, why does Synchronous exist? Recovery POINT Objective RTO: How long can you afford to be down? Recovery TIME Objective
  39. With Synchronous—what if the standby (or subscriber) goes away? Physical

    replication PRIMARY STANDBY PUBLISHER SUBSCRIBER Logical replication 47
  40. With Synchronous—what if the standby (or subscriber) goes away? Commit

    waits & waits. Writes stop! Physical replication PRIMARY STANDBY PUBLISHER SUBSCRIBER Logical replication 48
  41. Chapter 7 49 Why replicate? Words you’ll hear It all

    starts with WAL What gets copied? How does it get there? Does the commit wait? Secret Decoder Ring But what about Cloud architectures?
  42. Decoder Ring for Postgres Replication WHAT GETS COPIED? Physical replication

    byte-level WAL records Logical replication row-level decoded changes 52 HOW DOES IT GET THERE? DOES THE COMMIT WAIT? Streaming Asynchronous as it is written or Synchronous or Log shipping whole finished WAL files Streaming ONLY no other option Asynchronous ONLY Asynchronous or Synchronous @clairegiordano
  43. What Type of Replication do HA & Failover use? WHAT

    GETS COPIED? Physical replication byte-level WAL records Logical replication 53 HOW DOES IT GET THERE? DOES THE COMMIT WAIT? Streaming Asynchronous as it is written Synchronous Log shipping Asynchronous ONLY Streaming ONLY Asynchronous Synchronous @clairegiordano
  44. What about Disaster Recovery? WHAT GETS COPIED? DOES THE COMMIT

    WAIT? Streaming Asynchronous Physical replication as it is written byte-level WAL records Log shipping Logical replication 55 HOW DOES IT GET THERE? whole finished WAL files Streaming ONLY Synchronous Asynchronous ONLY Asynchronous Synchronous @clairegiordano
  45. What about Read Replicas (aka “Read Scaling”?) WHAT GETS COPIED?

    Physical replication byte-level WAL records Logical replication 57 HOW DOES IT GET THERE? DOES THE COMMIT WAIT? Streaming Asynchronous as it is written Synchronous Log shipping Asynchronous ONLY Streaming ONLY Asynchronous Synchronous @clairegiordano
  46. Speaking of Read Replicas—which are standbys you also read from

    Will “replication lag” be a problem? 58
  47. What Type of Replication do Migrations use? WHAT GETS COPIED?

    Physical replication byte-level WAL records Logical replication row-level decoded changes 59 HOW DOES IT GET THERE? DOES THE COMMIT WAIT? Streaming Asynchronous as it is written Synchronous Log shipping Asynchronous ONLY Streaming ONLY Asynchronous no other option Synchronous @clairegiordano
  48. What about the Data Sharing scenario? WHAT GETS COPIED? HOW

    DOES IT GET THERE? Streaming Physical replication Logical replication row-level decoded changes 61 DOES THE COMMIT WAIT? Asynchronous Synchronous Log shipping Asynchronous ONLY Streaming ONLY Asynchronous no other option Synchronous @clairegiordano
  49. Speaking of Data Sharing via Logical replication If the subscriber

    stops listening, will the replication slot & WAL run into trouble on the publisher? 62
  50. For 4 of 5 use cases: Look what keeps lighting

    up! WHAT GETS COPIED? Physical replication HOW DOES IT GET THERE? DOES THE COMMIT WAIT? Streaming Asynchronous as it is written byte-level WAL records Same 3 features, over & over. 1 mechanism (standby replaying WAL): What changes is the job to be done 63 @clairegiordano
  51. Chapter 8 64 Why replicate? Words you’ll hear It all

    starts with WAL What gets copied? How does it get there? Does the commit wait? Secret Decoder Ring But what about cloud architectures?
  52. With shared storage in the cloud, the WAL might not

    need to travel to the read replica at all… aka.ms/talk-HorizonDB-cmudb
  53. 1 3 favorite links for learning about 2 Replication! Talk:

    The Wonderful World of WAL by Bruce Momjian at POSETTE 2026 3 Talk about HorizonDB architecture by Adam Prout at CMUDB aka.ms/bruce-momjian-WAL-posette2026 Podcast: Postgres FM on Replication by Michael & Nikolay postgres.fm/episodes/replication aka.ms/talk-horizondb-cmudb