Santa Clara, California | April 23th – 25th, 2018
DistributedPostgreSQL
2
Simon Riggs
CTO, 2ndQuadrant, leading PostgreSQL Support Company
Database Architect & Consultant
Author of “PostgreSQL Admin Cookbook”
PostgreSQL Major Contributor for 15 years
PostgreSQL Committer
3
Topics
Replication for High Availability
Interoperability & Remote Data Access
Multi-node Databases
Replication forHigh Availability
5
Physical Streaming Replication
6
Physical Replication Features
7
Notes
Streaming Replication using Write Ahead Log (WAL) data
2ndQuadrant repmgr for failover management
2ndQuadrant Barman for Backup & Recovery Management
Remote Data Access
9
PostgreSQL Interoperability
10
PostgreSQL Remote Data Access (Pull)
CREATE EXTENSION postgres_fdw;
CREATE SERVER red FOREIGN DATA WRAPPER postgres_fdwOPTIONS …;
IMPORT FOREIGN SCHEMA myappFROM SERVER redINTO myapp_local;
SELECT * FROM myapp_local.table1;
11
PostgreSQL Foreign Data Wrapper
postgres_fdw• Access to other PostgreSQL servers, even with differing release levels• WHERE clause, joins pushed down to Foreign Server
file_fdw• Allows you to access data in same way as a COPY command
External projects• MySQL• Oracle• ODBC
12
PostgreSQL Pub/Sub Replication (Push)
<manage DDL copying>
CREATE PUBLICATION mypublisheddata;
CREATE SUBSCRIPTION mysubPUBLICATION mypublisheddataCONNECTION ‘service=node1’;
13
PostgreSQL Advanced Features
Push (“Logical”) or Pull Data Access (FDWs)
Multi-server heterogeneous SQL
Improvements in every release
2ndQuadrant pglogical for online upgrade
Multi-node Access
15
Topics
Sharding
Multi-node Query
Multi-master Database
16
Sharding
Store data across multiple nodes in cluster
Access mechanism to route queries and writes
Elastically Scalability to enlarge cluster
17
Multi-node Query
Requires consistency model to retrieve consistent data set
Node redistribution required to handle all join types
Multi-node aware optimizer to understand how to cope
18
Massively Parallel Processing (MPP) withPostgres-XL
19
Postgres-XL
Fork of PostgreSQL 10 to provide Scalable PostgreSQL
Hash distributed tables and replicated tables
Multi-node transactions, Multi-node consistency
Multi-node planner and inter-node data redistribution
High volume Data Load Queue
20
21
22
23
Postgres-BDR
BDR3 runs as a PostgreSQL Extension on PG10+
Multi-Master Replication/ Very High Availability architecture
2-way Logical Replication with conflict detection/handling
Duplicated and Local tables
Write scaling with local nodes
24
Multi-node Options
Sharding – Native Postgres, Citus
MPP – Postgres-XL, Greenplum
Multi-master Database – 2ndQuadrant BDR
25
Rate My Session
Thank You!Simon Riggs, 2ndQuadrant