SlideShare a Scribd company logo
Replication
By Pat Wright
About Me
• 15+ years working with data
• Avid Volunteer
• Avid Picture Taker
Twitter: @SQLAsylum
Email: Sqlasylum@gmail.com
RDBMS types of Replication
● Master-Slave
● Logical/Object
● Standby/Mirror
● Merge/Rack/Master-Master
● Logship/replay
Master / Slave / Mirror
Pros:
● Failover if synchronous
● Asynchronous or Synchronous
● Everything Duplicated
● Can split Reads/Writes
Cons:
● 2 points of failure instead of one in synchronous
● Everything Duplicated
● Can delay/slow down writes
Use Cases: HA, Splitting Reads/Writes in a real time
scenario
Master Slave
App
Begin Transaction
Transaction complete
Commit to slave(wait for ack)
Ack
Synchronous
Merge/Rack/Multi-Master
Pros:
● Can write/read from anywhere
● Highly available
● SCALE!
Cons:
● Postgres doesn’t have this(out of the box)
● Very difficult to get right
● Conflict resolution needs to be understood
Use Cases: Highly available highly scalable needs.
Master Master
App
Merge
App
Log Ship Replay
Pros:
● Offsite/Wan
● Disaster Recovery
Cons:
● Delayed
● Slow
● Management
Use cases: Disaster Recovery, offsite backup
Master Master
App
Wal/Logs
Wal/Logs
App only knows about Master
Copy/ftp Files
Logical /Object Replication
Pros:
● Certain objects
● Destination can be changed
● Different schemas
Cons:
● Breaking changes
● Reads the WAL log excessively(v10&V11)
● Management/updating
Use cases: Data Warehouse, reporting.
Master/
Publisher
Master/
Subscriber
App
Table_a
Table_b
Table_c
Table_d
Asynchronous
Reads WAL Log
App only knows about Master
Different indexes/columns can be added
to subscriber
Logical Replication
● Per table basis
● Different Indexes/Schema
● Changes can be made
● Can limit based on
DDL(Insert, update, delete)
● Reads the Wal Log (a lot)
● Setup/Snapshots can be
painful
Image taken from: https://severalnines.com/blog/postgresql-streaming-replication-deep-dive
When to Use Logical
● Consolodiate databases/systems to one
● Upgrade/migration paths
● Different set of users/schema to get data to.
● Different performance footprint(different indexes)
Limits
● Tables must have the same full qualified name between publication and
subscription.
● Tables must have primary key or unique key
● Does not replicate schema ,Sequences, Truncate stmnt or Blobs
Setup/Create
1. Create A publication.
2. Create tables on Subscription.
3. Copy Data from publisher to subscriber(optional depending on size).
4. Create a Subscription.
Monitoring
● Pg_stat_replication
● Pg_publication
● Pg_subscription
● pg_replication_slots
Summary
● Replication is needed for read slaves/reporting needs.
● More changes mean more nightmares/work.
● Be aware of Snapshotting/Reloading for large tables.
About Me
• 15+ years working with data
• Avid Volunteer
• Avid Picture Taker
Twitter: @SQLAsylum
Email: Sqlasylum@gmail.com
Resources
https://severalnines.com/blog/postgresql-streaming-replication-deep-dive
https://severalnines.com/blog/overview-logical-replication-postgresql

More Related Content

Similar to Replication with postgres and Getting started with Logical Replication (20)

PPTX
Built-in-Physical-and-Logical-Replication-in-Postgresql-Firat-Gulec.pptx
nadirpervez2
 
PPTX
Logical Replication in PostgreSQL
EDB
 
PDF
Replication in PostgreSQL tutorial given in Postgres Conference 2019
Abbas Butt
 
PDF
Types of replication, pooling and ha
Dimitar Ianakiev
 
ODP
Mysql
abhijith
 
PPTX
PG_Phsycal_logical_study_Replication.pptx
ankitmodidba
 
PPT
MySQL 5.1 Replication
Ligaya Turmelle
 
PDF
PostgreSQL Replication High Availability Methods
Mydbops
 
PDF
PGConf.ASIA 2017 Logical Replication Internals (English)
Noriyoshi Shinoda
 
PDF
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
EDB
 
PDF
PostgreSQL replication
NTT DATA OSS Professional Services
 
PDF
Replication tutorial presentation
colderboy17
 
PDF
Streaming Replication (Keynote @ PostgreSQL Conference 2009 Japan)
Masao Fujii
 
PDF
PGConf APAC 2018: PostgreSQL 10 - Replication goes Logical
PGConf APAC
 
PDF
PostgreSQL replication
Masao Fujii
 
PPT
arch_mtg_sqlsig_hcotter_replication.ppt
ssuser418eef
 
PPT
Intro to MySQL Master Slave Replication
satejsahu
 
PPT
MySQL Replication Basics
Abdul Manaf
 
PDF
MySQL Developer Day conference: MySQL Replication and Scalability
Shivji Kumar Jha
 
ODP
PostgreSQL Replication in 10 Minutes - SCALE
PostgreSQL Experts, Inc.
 
Built-in-Physical-and-Logical-Replication-in-Postgresql-Firat-Gulec.pptx
nadirpervez2
 
Logical Replication in PostgreSQL
EDB
 
Replication in PostgreSQL tutorial given in Postgres Conference 2019
Abbas Butt
 
Types of replication, pooling and ha
Dimitar Ianakiev
 
Mysql
abhijith
 
PG_Phsycal_logical_study_Replication.pptx
ankitmodidba
 
MySQL 5.1 Replication
Ligaya Turmelle
 
PostgreSQL Replication High Availability Methods
Mydbops
 
PGConf.ASIA 2017 Logical Replication Internals (English)
Noriyoshi Shinoda
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
EDB
 
PostgreSQL replication
NTT DATA OSS Professional Services
 
Replication tutorial presentation
colderboy17
 
Streaming Replication (Keynote @ PostgreSQL Conference 2009 Japan)
Masao Fujii
 
PGConf APAC 2018: PostgreSQL 10 - Replication goes Logical
PGConf APAC
 
PostgreSQL replication
Masao Fujii
 
arch_mtg_sqlsig_hcotter_replication.ppt
ssuser418eef
 
Intro to MySQL Master Slave Replication
satejsahu
 
MySQL Replication Basics
Abdul Manaf
 
MySQL Developer Day conference: MySQL Replication and Scalability
Shivji Kumar Jha
 
PostgreSQL Replication in 10 Minutes - SCALE
PostgreSQL Experts, Inc.
 

Recently uploaded (20)

DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Ad

Replication with postgres and Getting started with Logical Replication

  • 2. About Me • 15+ years working with data • Avid Volunteer • Avid Picture Taker Twitter: @SQLAsylum Email: [email protected]
  • 3. RDBMS types of Replication ● Master-Slave ● Logical/Object ● Standby/Mirror ● Merge/Rack/Master-Master ● Logship/replay
  • 4. Master / Slave / Mirror Pros: ● Failover if synchronous ● Asynchronous or Synchronous ● Everything Duplicated ● Can split Reads/Writes Cons: ● 2 points of failure instead of one in synchronous ● Everything Duplicated ● Can delay/slow down writes Use Cases: HA, Splitting Reads/Writes in a real time scenario Master Slave App Begin Transaction Transaction complete Commit to slave(wait for ack) Ack Synchronous
  • 5. Merge/Rack/Multi-Master Pros: ● Can write/read from anywhere ● Highly available ● SCALE! Cons: ● Postgres doesn’t have this(out of the box) ● Very difficult to get right ● Conflict resolution needs to be understood Use Cases: Highly available highly scalable needs. Master Master App Merge App
  • 6. Log Ship Replay Pros: ● Offsite/Wan ● Disaster Recovery Cons: ● Delayed ● Slow ● Management Use cases: Disaster Recovery, offsite backup Master Master App Wal/Logs Wal/Logs App only knows about Master Copy/ftp Files
  • 7. Logical /Object Replication Pros: ● Certain objects ● Destination can be changed ● Different schemas Cons: ● Breaking changes ● Reads the WAL log excessively(v10&V11) ● Management/updating Use cases: Data Warehouse, reporting. Master/ Publisher Master/ Subscriber App Table_a Table_b Table_c Table_d Asynchronous Reads WAL Log App only knows about Master Different indexes/columns can be added to subscriber
  • 8. Logical Replication ● Per table basis ● Different Indexes/Schema ● Changes can be made ● Can limit based on DDL(Insert, update, delete) ● Reads the Wal Log (a lot) ● Setup/Snapshots can be painful Image taken from: https://severalnines.com/blog/postgresql-streaming-replication-deep-dive
  • 9. When to Use Logical ● Consolodiate databases/systems to one ● Upgrade/migration paths ● Different set of users/schema to get data to. ● Different performance footprint(different indexes) Limits ● Tables must have the same full qualified name between publication and subscription. ● Tables must have primary key or unique key ● Does not replicate schema ,Sequences, Truncate stmnt or Blobs
  • 10. Setup/Create 1. Create A publication. 2. Create tables on Subscription. 3. Copy Data from publisher to subscriber(optional depending on size). 4. Create a Subscription.
  • 11. Monitoring ● Pg_stat_replication ● Pg_publication ● Pg_subscription ● pg_replication_slots
  • 12. Summary ● Replication is needed for read slaves/reporting needs. ● More changes mean more nightmares/work. ● Be aware of Snapshotting/Reloading for large tables.
  • 13. About Me • 15+ years working with data • Avid Volunteer • Avid Picture Taker Twitter: @SQLAsylum Email: [email protected] Resources https://severalnines.com/blog/postgresql-streaming-replication-deep-dive https://severalnines.com/blog/overview-logical-replication-postgresql