SlideShare a Scribd company logo
Mike Fowler (mike.fowler@claranet.uk)
Hosted PostgreSQL
ā—
Senior Site Reliability Engineer in the Public Cloud
Practice of claranet
ā—
Background in Software Engineering, Systems
Engineering, System & Database Administration
ā—
Contributed to several open source projects (YAWL,
PostgreSQL & Terraform)
ā—
Been using PostgreSQL since 7.4
About Me
ā—
Hosted PostgreSQL
ā—
Overview of public cloud hosting options
ā—
Database migration strategies
Overview
ā—
Your database somewhere else
ā—
A managed service
– Some providers offer full DBA support
– Cloud providers give only the infrastructure
ā—
Typically provisioned through an API or GUI
– i.e. a self-service environment
What is hosted PostgreSQL?
ā—
Reduces adoption costs
ā—
Installation & configuration is already done
– Generally sane defaults, some tuning often required
ā—
Needn’t worry about physical servers
ā—
Opex instead of Capex
ā—
Most routine DBA tasks are done for you
ā—
Easier to grow
Benefits of Hosted PostgreSQL
ā—
Less control
ā—
Latency
ā—
Some features are disabled
ā—
Migrating existing databases is hard
ā—
Potential for vendor lock-in
ā—
Resource limits
Drawbacks of Hosted PostgreSQL
ā—
We’ll look only at Public Cloud offerings
ā—
Current major offerings
– Amazon Relation Database Service (RDS)
– Heroku
ā—
Future major offerings
– Amazon Aurora
– Google Cloud SQL
– Microsoft Azure
Hosting Options
ā—
PostgreSQL 9.3.12 – 9.6.2 supported
ā—
Numerous instance types
– Costs range from $0.018 to $4.97 per hour
– Select from 1 vCPU up to 32 vCPUs, all 64-bit
– Memory ranges from 1GB to 244GB
ā—
Flexible storage options
– Choose between SSD or Provisioned IOPS
– Up to 6TB with up to 30,000 IOPS
Amazon RDS
ā—
High availability multi-availability zone option
– Synchronous replica
– Automatic failover (~2 minutes)
ā—
Up to 5 read-only replicas (asynchronous replication)
ā—
Configurable automatic backups with PITR
ā—
Monthly uptime percentage of 99.95 per instance
– Allows for approximately 22 minutes downtime
Amazon RDS
ā—
Supports PostgreSQL 9.3, 9.5, 9.6 & 9.6
ā—
Simpler pricing based on choice of tier ($0-8.5k pcm)
ā—
Tier dictates resource limits
– Maximum number of rows (Hobby only)
– Cache size (1GB - 240GB)
– Storage limit (64GB - 1TB)
– Connection limit (120 - 500)
– Rollback (4 days – 1 week)
Heroku
ā—
Fork & Follow
ā—
Some of your data may end up in the US
– Logs (can be blocked at creation time)
– Snapshots & Dataclips
ā—
Not possible to replicate out
– No permission for Bucardo, Londiste & Slony
– Remote slave is prohibited
– Only way is dump & restore
Heroku
ā—
Currently in open preview
– Largely free to use but no SLA
ā—
Compatible with PostgreSQL 9.6
ā—
Up to 2x throughput of conventional PostgreSQL
ā—
Up to 16 read replicas with sub-10ms replica lag
ā—
Auto-growing filesystem up to 64TB
– Filesystem is shared between 3 availability zones
Amazon Aurora
ā—
Currently in Beta (no SLA)
ā—
Only supports PostgreSQL 9.6
ā—
Only available in Iowa, no replication support
ā—
Posed to be a serious rival to RDS
– Billing per minute
– Automatic scaling of filesystem
– Similar variety of instance types
ā—
Minimal extensions but includes PostGIS
Google Cloud SQL
ā—
Currently in preview (no SLA)
ā—
Supports PostgreSQL 9.5 & 9.6
ā—
Replication is seamless
– Automated failover
– PITR
ā—
Selectable compute units
ā—
Supports some extensions including PostGIS
Microsoft Azure
ā—
Dump & Restore
ā—
Replication failover
ā—
PITR + Logical decoding
Migration Strategies
ā—
Simplest strategy
– Perceived as low risk for data loss
– Less ā€œmoving partsā€
ā—
Just a pg_dump & pg_restore
ā—
Downtime is function of database size
Dump & Restore
ā—
Move historic data ahead of time
– Opportunity to clear out unused data
– Consider introducing partitions
ā—
Consider moving the dump closer to the target
– e.g. Upload to EC2 instance in the same region as
the RDS instance and run pg_restore from there
ā—
Over provision resources
– Gives higher throughput during data load
– Downscale once operational
Strategies to Minimise Downtime
ā—
No one supports external masters!
ā—
Trigger based replication failover
– Slony, Londiste & Bucardo
ā—
Can be used on most any version of PostgreSQL
ā—
Some restrictions apply
– DDL is not supported
– Rows must be uniquely identifiable
Replication Failover
ā—
Presents some risk to production environment
– Initial overhead of replicating each table
ā—
Gradually add tables to the configuration to
spread the load
– Per-transaction overhead
ā—
Write latency to remote slave
ā—
Heavy write workload could lead to high
replication lag
ā—
This also works to replicate out of RDS but not Heroku
Replication Failover
ā—
Most involved approach, least downtime
ā—
Combines point-in-time recovery with the changes
captured by logical decoding to create a replica
ā—
Need to be running at least PostgreSQL 9.4 with WAL
level logical and have WAL archiving configured
ā—
DDL not supported, still need unique rows
ā—
Recommend barman for managing WAL
http://www.pgbarman.org/
ā—
Recommend decoder_raw as logical decoding plugin
github.com/michaelpq/pg_plugins/tree/master/decoder_raw
PITR & Logical decoding
1. Create a logical replication slot
SELECT * FROM
pg_create_logical_replication_slot
('logical_slot', 'decoder_raw');
2. Note the transaction ID (catalog_xmin)
SELECT catalog_xmin FROM
pg_replication_slots WHERE slot_name =
ā€˜logical_slot’;
PITR & Logical decoding
3. Perform a barman backup
$ barman backup master
4. Perform a barman PITR
$ barman recover –target-xid
(catalog_xmin - 1) master latest
5. Start database and verify correct recovery
PITR & Logical decoding
5. Perform pg_dump on the readonly barman node
6. Restore to public cloud
7. Read output of logical decoding and write to cloud
PITR & Logical decoding
ā—
Hosted PostgreSQL gives you high performance
PostgreSQL without the hassle of hardware,
maintenance and configuration
ā—
Opex instead of Capex
ā—
Consider the limitations of your intended platform
ā—
There are multiple options for migration
Summary
Hosted PostgreSQL

More Related Content

What's hot (20)

PPTX
Apache Con 2021 Structured Data Streaming
Shivji Kumar Jha
Ā 
PDF
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
distributed matters
Ā 
PDF
2016 jan-pugs-meetup-v9.5-features
Sameer Kumar
Ā 
PDF
Geographically Distributed PostgreSQL
mason_s
Ā 
PDF
Countdown to PostgreSQL v9.5 - Foriegn Tables can be part of Inheritance Tree
Ashnikbiz
Ā 
PDF
EVCache: Lowering Costs for a Low Latency Cache with RocksDB
Scott Mansfield
Ā 
PDF
Streaming Replication (Keynote @ PostgreSQL Conference 2009 Japan)
Masao Fujii
Ā 
PDF
Beyond Postgres: Interesting Projects, Tools and forks
Sameer Kumar
Ā 
PPTX
Repository performance tuning
Jukka Zitting
Ā 
PDF
MariaDB Performance Tuning and Optimization
MariaDB plc
Ā 
PPT
MySQL HA Percona cluster @ MySQL meetup Mumbai
Remote MySQL DBA
Ā 
PPT
Scaling MySQL using Fabric
Karthik .P.R
Ā 
PDF
hbaseconasia2017: HBase在Huluēš„ä½æē”Øå’Œå®žč·µ
HBaseCon
Ā 
PDF
PostgreSQL worst practices, version PGConf.US 2017 by Ilya Kosmodemiansky
PostgreSQL-Consulting
Ā 
PDF
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
The Hive
Ā 
PPTX
When is MyRocks good?
Alkin Tezuysal
Ā 
PDF
Pulsar - Distributed pub/sub platform
Matteo Merli
Ā 
PDF
Redis - The Universal NoSQL Tool
Eberhard Wolff
Ā 
PPTX
Redis Developers Day 2014 - Redis Labs Talks
Redis Labs
Ā 
PPTX
OSGifying the repository
Jukka Zitting
Ā 
Apache Con 2021 Structured Data Streaming
Shivji Kumar Jha
Ā 
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
distributed matters
Ā 
2016 jan-pugs-meetup-v9.5-features
Sameer Kumar
Ā 
Geographically Distributed PostgreSQL
mason_s
Ā 
Countdown to PostgreSQL v9.5 - Foriegn Tables can be part of Inheritance Tree
Ashnikbiz
Ā 
EVCache: Lowering Costs for a Low Latency Cache with RocksDB
Scott Mansfield
Ā 
Streaming Replication (Keynote @ PostgreSQL Conference 2009 Japan)
Masao Fujii
Ā 
Beyond Postgres: Interesting Projects, Tools and forks
Sameer Kumar
Ā 
Repository performance tuning
Jukka Zitting
Ā 
MariaDB Performance Tuning and Optimization
MariaDB plc
Ā 
MySQL HA Percona cluster @ MySQL meetup Mumbai
Remote MySQL DBA
Ā 
Scaling MySQL using Fabric
Karthik .P.R
Ā 
hbaseconasia2017: HBase在Huluēš„ä½æē”Øå’Œå®žč·µ
HBaseCon
Ā 
PostgreSQL worst practices, version PGConf.US 2017 by Ilya Kosmodemiansky
PostgreSQL-Consulting
Ā 
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
The Hive
Ā 
When is MyRocks good?
Alkin Tezuysal
Ā 
Pulsar - Distributed pub/sub platform
Matteo Merli
Ā 
Redis - The Universal NoSQL Tool
Eberhard Wolff
Ā 
Redis Developers Day 2014 - Redis Labs Talks
Redis Labs
Ā 
OSGifying the repository
Jukka Zitting
Ā 

Similar to Hosted PostgreSQL (20)

PDF
Migrating PostgreSQL to the Cloud
Mike Fowler
Ā 
PDF
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
Aleksander Alekseev
Ā 
PPTX
Keynote - Hosted PostgreSQL: An Objective Look
EDB
Ā 
ODP
Pro PostgreSQL, OSCon 2008
Robert Treat
Ā 
PDF
Postgres Vienna DB Meetup 2014
Michael Renner
Ā 
PDF
Pgbr 2013 postgres on aws
Emanuel Calvo
Ā 
PDF
Best Practices & Lessons Learned from Deployment of PostgreSQL
EDB
Ā 
PDF
PostgreSQL High Availability in a Containerized World
Jignesh Shah
Ā 
PDF
Think_your_Postgres_backups_and_recovery_are_safe_lets_talk.pptx
Payal Singh
Ā 
PDF
Out of the box replication in postgres 9.4
Denish Patel
Ā 
PDF
Out of the Box Replication in Postgres 9.4(PgCon)
Denish Patel
Ā 
PDF
Out of the Box Replication in Postgres 9.4(PgCon)
Denish Patel
Ā 
PPTX
Backups
Payal Singh
Ā 
PDF
Oracle to Postgres Migration - part 2
PgTraining
Ā 
PDF
Out of the box replication in postgres 9.4(pg confus)
Denish Patel
Ā 
PDF
Out of the Box Replication in Postgres 9.4(PgConfUS)
Denish Patel
Ā 
PPTX
OVHcloud – Enterprise Cloud Databases
OVHcloud
Ā 
PPTX
Deep dive into the Rds PostgreSQL Universe Austin 2017
Grant McAlister
Ā 
PDF
PGConf.ASIA 2019 Bali - Your Business Continuity Matrix and PostgreSQL's Disa...
Equnix Business Solutions
Ā 
PPTX
Amazon RDS for PostgreSQL: What's New and Lessons Learned - NY 2017
Grant McAlister
Ā 
Migrating PostgreSQL to the Cloud
Mike Fowler
Ā 
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
Aleksander Alekseev
Ā 
Keynote - Hosted PostgreSQL: An Objective Look
EDB
Ā 
Pro PostgreSQL, OSCon 2008
Robert Treat
Ā 
Postgres Vienna DB Meetup 2014
Michael Renner
Ā 
Pgbr 2013 postgres on aws
Emanuel Calvo
Ā 
Best Practices & Lessons Learned from Deployment of PostgreSQL
EDB
Ā 
PostgreSQL High Availability in a Containerized World
Jignesh Shah
Ā 
Think_your_Postgres_backups_and_recovery_are_safe_lets_talk.pptx
Payal Singh
Ā 
Out of the box replication in postgres 9.4
Denish Patel
Ā 
Out of the Box Replication in Postgres 9.4(PgCon)
Denish Patel
Ā 
Out of the Box Replication in Postgres 9.4(PgCon)
Denish Patel
Ā 
Backups
Payal Singh
Ā 
Oracle to Postgres Migration - part 2
PgTraining
Ā 
Out of the box replication in postgres 9.4(pg confus)
Denish Patel
Ā 
Out of the Box Replication in Postgres 9.4(PgConfUS)
Denish Patel
Ā 
OVHcloud – Enterprise Cloud Databases
OVHcloud
Ā 
Deep dive into the Rds PostgreSQL Universe Austin 2017
Grant McAlister
Ā 
PGConf.ASIA 2019 Bali - Your Business Continuity Matrix and PostgreSQL's Disa...
Equnix Business Solutions
Ā 
Amazon RDS for PostgreSQL: What's New and Lessons Learned - NY 2017
Grant McAlister
Ā 
Ad

More from Mike Fowler (13)

PDF
From Warehouses to Lakes: The Value of Streams
Mike Fowler
Ā 
PDF
From Warehouses to Lakes: The Value of Streams
Mike Fowler
Ā 
PDF
Getting Started with Machine Learning on AWS
Mike Fowler
Ā 
PDF
Building with Firebase
Mike Fowler
Ā 
PDF
Reducing Pager Fatigue Using a Serverless ML Bot
Mike Fowler
Ā 
PDF
Getting started with Machine Learning
Mike Fowler
Ā 
PPTX
Migrating with Debezium
Mike Fowler
Ā 
PDF
Leveraging Automation for a Disposable Infrastructure
Mike Fowler
Ā 
PDF
Shaping Clouds with Terraform
Mike Fowler
Ā 
PDF
Disposable infrastructure
Mike Fowler
Ā 
ODP
Fun Things to do with Logical Decoding
Mike Fowler
Ā 
ODP
Handling XML and JSON in the Database
Mike Fowler
Ā 
ODP
Migrating Rant & Rave to PostgreSQL
Mike Fowler
Ā 
From Warehouses to Lakes: The Value of Streams
Mike Fowler
Ā 
From Warehouses to Lakes: The Value of Streams
Mike Fowler
Ā 
Getting Started with Machine Learning on AWS
Mike Fowler
Ā 
Building with Firebase
Mike Fowler
Ā 
Reducing Pager Fatigue Using a Serverless ML Bot
Mike Fowler
Ā 
Getting started with Machine Learning
Mike Fowler
Ā 
Migrating with Debezium
Mike Fowler
Ā 
Leveraging Automation for a Disposable Infrastructure
Mike Fowler
Ā 
Shaping Clouds with Terraform
Mike Fowler
Ā 
Disposable infrastructure
Mike Fowler
Ā 
Fun Things to do with Logical Decoding
Mike Fowler
Ā 
Handling XML and JSON in the Database
Mike Fowler
Ā 
Migrating Rant & Rave to PostgreSQL
Mike Fowler
Ā 
Ad

Recently uploaded (20)

PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
Ā 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
Ā 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
Ā 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
Ā 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
Ā 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
Ā 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
Ā 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
Ā 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
Ā 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
Ā 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
Ā 
PPTX
Digital Circuits, important subject in CS
contactparinay1
Ā 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
Ā 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
Ā 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
Ā 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
Ā 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
Ā 
PDF
ā€œVoice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
Ā 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
Ā 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
Ā 
The Project Compass - GDG on Campus MSIT
dscmsitkol
Ā 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
Ā 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
Ā 
How do you fast track Agentic automation use cases discovery?
DianaGray10
Ā 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
Ā 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
Ā 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
Ā 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
Ā 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
Ā 
Mastering Financial Management in Direct Selling
Epixel MLM Software
Ā 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
Ā 
Digital Circuits, important subject in CS
contactparinay1
Ā 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
Ā 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
Ā 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
Ā 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
Ā 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
Ā 
ā€œVoice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
Ā 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
Ā 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
Ā 

Hosted PostgreSQL

  • 2. ā— Senior Site Reliability Engineer in the Public Cloud Practice of claranet ā— Background in Software Engineering, Systems Engineering, System & Database Administration ā— Contributed to several open source projects (YAWL, PostgreSQL & Terraform) ā— Been using PostgreSQL since 7.4 About Me
  • 3. ā— Hosted PostgreSQL ā— Overview of public cloud hosting options ā— Database migration strategies Overview
  • 4. ā— Your database somewhere else ā— A managed service – Some providers offer full DBA support – Cloud providers give only the infrastructure ā— Typically provisioned through an API or GUI – i.e. a self-service environment What is hosted PostgreSQL?
  • 5. ā— Reduces adoption costs ā— Installation & configuration is already done – Generally sane defaults, some tuning often required ā— Needn’t worry about physical servers ā— Opex instead of Capex ā— Most routine DBA tasks are done for you ā— Easier to grow Benefits of Hosted PostgreSQL
  • 6. ā— Less control ā— Latency ā— Some features are disabled ā— Migrating existing databases is hard ā— Potential for vendor lock-in ā— Resource limits Drawbacks of Hosted PostgreSQL
  • 7. ā— We’ll look only at Public Cloud offerings ā— Current major offerings – Amazon Relation Database Service (RDS) – Heroku ā— Future major offerings – Amazon Aurora – Google Cloud SQL – Microsoft Azure Hosting Options
  • 8. ā— PostgreSQL 9.3.12 – 9.6.2 supported ā— Numerous instance types – Costs range from $0.018 to $4.97 per hour – Select from 1 vCPU up to 32 vCPUs, all 64-bit – Memory ranges from 1GB to 244GB ā— Flexible storage options – Choose between SSD or Provisioned IOPS – Up to 6TB with up to 30,000 IOPS Amazon RDS
  • 9. ā— High availability multi-availability zone option – Synchronous replica – Automatic failover (~2 minutes) ā— Up to 5 read-only replicas (asynchronous replication) ā— Configurable automatic backups with PITR ā— Monthly uptime percentage of 99.95 per instance – Allows for approximately 22 minutes downtime Amazon RDS
  • 10. ā— Supports PostgreSQL 9.3, 9.5, 9.6 & 9.6 ā— Simpler pricing based on choice of tier ($0-8.5k pcm) ā— Tier dictates resource limits – Maximum number of rows (Hobby only) – Cache size (1GB - 240GB) – Storage limit (64GB - 1TB) – Connection limit (120 - 500) – Rollback (4 days – 1 week) Heroku
  • 11. ā— Fork & Follow ā— Some of your data may end up in the US – Logs (can be blocked at creation time) – Snapshots & Dataclips ā— Not possible to replicate out – No permission for Bucardo, Londiste & Slony – Remote slave is prohibited – Only way is dump & restore Heroku
  • 12. ā— Currently in open preview – Largely free to use but no SLA ā— Compatible with PostgreSQL 9.6 ā— Up to 2x throughput of conventional PostgreSQL ā— Up to 16 read replicas with sub-10ms replica lag ā— Auto-growing filesystem up to 64TB – Filesystem is shared between 3 availability zones Amazon Aurora
  • 13. ā— Currently in Beta (no SLA) ā— Only supports PostgreSQL 9.6 ā— Only available in Iowa, no replication support ā— Posed to be a serious rival to RDS – Billing per minute – Automatic scaling of filesystem – Similar variety of instance types ā— Minimal extensions but includes PostGIS Google Cloud SQL
  • 14. ā— Currently in preview (no SLA) ā— Supports PostgreSQL 9.5 & 9.6 ā— Replication is seamless – Automated failover – PITR ā— Selectable compute units ā— Supports some extensions including PostGIS Microsoft Azure
  • 15. ā— Dump & Restore ā— Replication failover ā— PITR + Logical decoding Migration Strategies
  • 16. ā— Simplest strategy – Perceived as low risk for data loss – Less ā€œmoving partsā€ ā— Just a pg_dump & pg_restore ā— Downtime is function of database size Dump & Restore
  • 17. ā— Move historic data ahead of time – Opportunity to clear out unused data – Consider introducing partitions ā— Consider moving the dump closer to the target – e.g. Upload to EC2 instance in the same region as the RDS instance and run pg_restore from there ā— Over provision resources – Gives higher throughput during data load – Downscale once operational Strategies to Minimise Downtime
  • 18. ā— No one supports external masters! ā— Trigger based replication failover – Slony, Londiste & Bucardo ā— Can be used on most any version of PostgreSQL ā— Some restrictions apply – DDL is not supported – Rows must be uniquely identifiable Replication Failover
  • 19. ā— Presents some risk to production environment – Initial overhead of replicating each table ā— Gradually add tables to the configuration to spread the load – Per-transaction overhead ā— Write latency to remote slave ā— Heavy write workload could lead to high replication lag ā— This also works to replicate out of RDS but not Heroku Replication Failover
  • 20. ā— Most involved approach, least downtime ā— Combines point-in-time recovery with the changes captured by logical decoding to create a replica ā— Need to be running at least PostgreSQL 9.4 with WAL level logical and have WAL archiving configured ā— DDL not supported, still need unique rows ā— Recommend barman for managing WAL http://www.pgbarman.org/ ā— Recommend decoder_raw as logical decoding plugin github.com/michaelpq/pg_plugins/tree/master/decoder_raw PITR & Logical decoding
  • 21. 1. Create a logical replication slot SELECT * FROM pg_create_logical_replication_slot ('logical_slot', 'decoder_raw'); 2. Note the transaction ID (catalog_xmin) SELECT catalog_xmin FROM pg_replication_slots WHERE slot_name = ā€˜logical_slot’; PITR & Logical decoding
  • 22. 3. Perform a barman backup $ barman backup master 4. Perform a barman PITR $ barman recover –target-xid (catalog_xmin - 1) master latest 5. Start database and verify correct recovery PITR & Logical decoding
  • 23. 5. Perform pg_dump on the readonly barman node 6. Restore to public cloud 7. Read output of logical decoding and write to cloud PITR & Logical decoding
  • 24. ā— Hosted PostgreSQL gives you high performance PostgreSQL without the hassle of hardware, maintenance and configuration ā— Opex instead of Capex ā— Consider the limitations of your intended platform ā— There are multiple options for migration Summary