SlideShare a Scribd company logo
1 of 30
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
PostgreSQL
Scott Mead
meads@amazon.com
Sr Consultant
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
What is PostgreSQL?
• A Relational Database Management System
• An Object Relational Database
– Can add First Class simple and
complex objects with methods,
that can be used in a
Relational Context
– Queries can be made with SQL
• Pronounced “POST-gress”
– The “QL” is silent
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Open source database
In active development for over 20 years
Owned by a foundation, not a single company
Permissive innovation-friendly open source license
PostgreSQL Fast Facts
Open Source Initiative
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
High performance out of the box
Object-oriented and ANSI-SQL:2008 compatible
Most geospatial features of any open-source database
Supports stored procedures in 12 languages (Java, Perl,
Python, Ruby, Tcl, C/C++, its own Oracle-like PL/pgSQL, and
others)
PostgreSQL Fast Facts
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Most Oracle-compatible open-source database
Highest AWS Schema Conversion Tool automatic
conversion rates are from Oracle to PostgreSQL
PostgreSQL Fast Facts
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
PostgreSQL Deployment Options
On-Premises Hosted Managed
EC2 DB Services
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
On-Premise PostgreSQL Deployment
Power, HVAC, net
Rack and stack
Server maintenance
OS patches
DB s/w patches
Database backups
Scaling
High availability
DB s/w installs
OS installation
you
App optimization
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Hosting PostgreSQL on Amazon EC2
Power, HVAC, net
Rack and stack
Server maintenance
OS patches
DB s/w patches
Database backups
Scaling
High availability
DB s/w installs
OS installation
App optimization
you
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Managed PostgreSQL on RDS or Aurora
Power, HVAC, net
Rack and stack
Server maintenance
OS patches
DB s/w patches
Database backups
App optimization
High availability
DB s/w installs
OS installation
Scaling
you
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS: Security and Compliance
• Network isolation
• Database instance IP firewall
protection
• AWS IAM-based resource-level
permission controls
• Encryption at rest using AWS KMS or
Oracle/Microsoft TDE
• SSL protection for data in transit
• Assurance programs for finance,
healthcare, government, and more
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Amazon Virtual Private Cloud (Amazon VPC)
Securely control network configuration
Availability Zone
AWS Region
10.1.0.0/16
10.1.1.0/24
Manage connectivity
AWS Direct
Connect
VPN
connection
VPC
peering
Internet
gateway
Routing
rules
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS: IAM-Governed Access
Use AWS Identity and Access Management (IAM) to control who can perform
actions on Amazon RDS
Users and DBAApplications DBA and Ops
Your database RDS
Controlled with IAMControlled with database grants
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS: At-Rest Encryption
• Two-tiered key hierarchy using envelope
encryption
• Unique data key encrypts customer data
• AWS KMS master keys encrypt data keys
• Available for all RDS engines
• Benefits:
• Limits risk of compromised data key
• Better performance for encrypting large
data
• Easier to manage small number of master
keys than millions of data keys
• Centralized access and audit of key activity
Leveraging AWS Key Management Service (AWS KMS)
Data key 1 Data key 2 Data key 3 Data key 4
Customer master
key(s)
Amazon RDS
instance 3
Amazon RDS
instance 2
Amazon RDS
instance 1
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS: Compliance
Singapore MTCS
27001/9001
27017/27018
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS: Effortless Scaling
• Scale compute/memory vertically up or down
• Handle higher load to grow over time
• Lower usage to control costs
Storage scaling
EBS Based—20 GB->6 TB & up to 30,000 IOPS
Aurora Based—Up to 64 TB
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS: Backup and Disaster Recovery
• DB Snapshots
– User-driven snapshots of database
– Kept until explicitly deleted
• Automated Backups
– Nightly system snapshots + transaction backup
– Enables point-in-time restore to any point in retention period, up to the last
5 minutes
– Max retention period = 35 days
• Cross region copy
– Change regions
– Disaster recovery
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS Availability—Read and Write—Multi-AZ
SecondarySecondary Primary
Physical
Synchronous
Replication
Primary
AZ1 AZ2
DNS
cname update
Application Application
Primary Update
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS: Logical Replication Support
• Supported with 9.6.1+, 9.5.4+ and 9.4.9+
• Set rds.logical_replication parameter to 1
• As user who has rds_replication and rds_superuser role
SELECT * FROM pg_create_logical_replication_slot('test_slot',
'test_decoding');
pg_recvlogical -d postgres --slot test_slot -U master --host $rds_hostname -f -
--start
• Support for event triggers
RDS
Postgres
RDS
Postgres
Logical
Replica
Redshift
EC2
Postgres
On
Premise
Postgres
DMS
RDS/Aurora
PostgreSQL
Custom
Logical
Handler
NoSQL
DB
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Amazon RDS for PostgreSQL
Supporting Latest Minor Releases
• 9.6.5
• 9.5.9
• 9.4.14
• 9.3.19
Now Available —PostgreSQL 10.1
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Notable Features
• Support HugePages for RDS PostgreSQL
• Provides performance benefit for large instances
• Stop and start of RDS PostgreSQL instances
• New regions supported for RDS PostgreSQL
• China
• Brazil
• Support encryption at rest for
– T2 small/medium
– Cross-region Read Replicas
• Flexible RI
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
New PostgreSQL Extensions Supported
Extensions Description
pgrouting Provides geospatial routing functionality for PostGIS
postgresql-hll HyperLogLog data type support
decoder_raw Output plugin to generates raw queries for logical replication changes
pg_repack Remove bloat from tables and indexes in version 9.6.3
pgaudit Provide detailed session and object audit logging in versions 9.6.3 and 9.5.7
wal2json Output plugin for logical decoding in versions 9.6.3 and 9.5.7
auto_explain Log execution plans of slow statements automatically in versions 9.6.3 and 9.5.7
pg_hint_plan Provides control of execution plans by using hint phrases
log_fdw Extension to query your database engine logs within the database
pg_freespacemap Examine free space map
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Extension—pgaudit (9.6.3+)
• CREATE ROLE rds_pgaudit
• Add pgaudit to shared_preload_libraries and pgaudit.role = rds_pgaudit in a
custom parameter group in PostgreSQL 9.6 family
• Apply the modified parameter group to 9.6.3+ database instance and apply immediately
• CREATE EXTENSION pgaudit
• Grant SELECT on all tables to rds_pgaudit to enable auditing
• GRANT SELECT ON t1 TO rds_pgaudit;
• Database logs will show entry as follows
• ... 2017-06-12 19:09:49 UTC:…:pgadmin@postgres:[11701]:LOG: AUDIT:
OBJECT,1,1,READ,SELECT,TABLE,public.t1,select * from t1; ...
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Extension—pg_stat_statements
• CREATE EXTENSION pg_stat_statements
• SELECT * from pg_stat_statements order by total_time DESC;
-[ RECORD 2 ]-------+--------
userid | 16388
dbid | 16464
queryid | 4286627671
query | UPDATE pgbench_accounts SET abalance = abalance + ? WHERE aid = ?;
calls | 165125
total_time | 5251.54200000001
min_time | 0.015
max_time | 5.558
mean_time | 0.0318034337623008
stddev_time | 0.0369181019548524
rows | 165125
• SELECT substring(query, 1, 50) AS short_query,
round(total_time::numeric, 2) AS total_time, calls,
round(mean_time::numeric, 2) AS mean, round((100 * total_time
/sum(total_time::numeric) OVER ())::numeric, 2) AS percentage_cpu FROM
pg_stat_statements ORDER BY total_time DESC LIMIT 10;
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
PostgreSQL 9.6 + Amazon Aurora cloud-optimized storage
 Performance: 2x–3x higher throughput than PostgreSQL alone
 Availability: failover time of <30 seconds
 Durability: six copies across three Availability Zones
 Read Replicas: single-digit millisecond lag times on up to 15 replicas
Amazon Aurora Storage
Aurora PostgreSQL
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Amazon Aurora Storage Engine Overview
• Data is replicated six times across three
Availability Zones
• Continuous backup to Amazon S3 (built for 11
9s durability)
• Continuous monitoring of nodes and disks for
repair
• 10 GB segments as unit of repair or hotspot
rebalance
• Quorum system for read/write; latency tolerant
• Quorum membership changes do not stall writes
• Storage volume automatically grows up to 64
TB
AZ 1 AZ 2 AZ 3
Amazon S3
Database
Node
Storage
Node
Storage
Node
Storage
Node
Storage
Node
Storage
Node
Storage
Node
Storage
Monitoring
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS/Aurora PostgreSQL Monitoring
• Amazon CloudWatch metrics
– CPU utilization
– Storage
– Memory
– Swap usage
– DB connections
– I/O (read and write)
– Latency (read and write)
– Throughput (read and write)
– Replica lag
• Amazon CloudWatch alarms
– Similar to on-premises monitoring tools
• Enhanced Monitoring for Amazon RDS
– Access to over 50 CPU, memory, file
system, and disk I/O metrics
– Low as 1 second intervals
• Integration with third-party monitoring tools
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Performance Insight: Simplifying Monitoring
• Dashboard displaying load on
database
– Easy
– Powerful
• Identifies source of
bottlenecks
– Top SQL
• Adjustable time frame
– Hour, day, week, month
– Up to 35 days of data
Max CPU
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
PostgreSQL Events and Logs
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
CloudWatch Metric—Max Used Trans IDs
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
aws.amazon.com/activate
Everything and Anything Startups
Need to Get Started on AWS

More Related Content

What's hot

Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationEDB
 
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of FacebookTech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of FacebookThe Hive
 
RocksDB detail
RocksDB detailRocksDB detail
RocksDB detailMIJIN AN
 
Spark shuffle introduction
Spark shuffle introductionSpark shuffle introduction
Spark shuffle introductioncolorant
 
Facebook Messages & HBase
Facebook Messages & HBaseFacebook Messages & HBase
Facebook Messages & HBase强 王
 
A Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQLA Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQLDatabricks
 
Parquet performance tuning: the missing guide
Parquet performance tuning: the missing guideParquet performance tuning: the missing guide
Parquet performance tuning: the missing guideRyan Blue
 
PostgreSQL HA
PostgreSQL   HAPostgreSQL   HA
PostgreSQL HAharoonm
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PGConf APAC
 
Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...
Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...
Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...Flink Forward
 
Introducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes OperatorIntroducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes OperatorFlink Forward
 
Chasing the optimizer
Chasing the optimizerChasing the optimizer
Chasing the optimizerMauro Pagano
 
The Apache Spark File Format Ecosystem
The Apache Spark File Format EcosystemThe Apache Spark File Format Ecosystem
The Apache Spark File Format EcosystemDatabricks
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuningSimon Huang
 
Introduction to PostgreSQL
Introduction to PostgreSQLIntroduction to PostgreSQL
Introduction to PostgreSQLJim Mlodgenski
 
RocksDB compaction
RocksDB compactionRocksDB compaction
RocksDB compactionMIJIN AN
 
Real-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache PinotReal-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache PinotXiang Fu
 

What's hot (20)

Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of FacebookTech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
 
RocksDB detail
RocksDB detailRocksDB detail
RocksDB detail
 
Spark shuffle introduction
Spark shuffle introductionSpark shuffle introduction
Spark shuffle introduction
 
Facebook Messages & HBase
Facebook Messages & HBaseFacebook Messages & HBase
Facebook Messages & HBase
 
A Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQLA Deep Dive into Query Execution Engine of Spark SQL
A Deep Dive into Query Execution Engine of Spark SQL
 
Parquet performance tuning: the missing guide
Parquet performance tuning: the missing guideParquet performance tuning: the missing guide
Parquet performance tuning: the missing guide
 
PostgreSQL HA
PostgreSQL   HAPostgreSQL   HA
PostgreSQL HA
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
 
PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
 
Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...
Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...
Virtual Flink Forward 2020: Netflix Data Mesh: Composable Data Processing - J...
 
Introducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes OperatorIntroducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes Operator
 
Chasing the optimizer
Chasing the optimizerChasing the optimizer
Chasing the optimizer
 
PostgreSQL Replication Tutorial
PostgreSQL Replication TutorialPostgreSQL Replication Tutorial
PostgreSQL Replication Tutorial
 
The Apache Spark File Format Ecosystem
The Apache Spark File Format EcosystemThe Apache Spark File Format Ecosystem
The Apache Spark File Format Ecosystem
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
 
Introduction to PostgreSQL
Introduction to PostgreSQLIntroduction to PostgreSQL
Introduction to PostgreSQL
 
RocksDB compaction
RocksDB compactionRocksDB compaction
RocksDB compaction
 
The Impala Cookbook
The Impala CookbookThe Impala Cookbook
The Impala Cookbook
 
Real-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache PinotReal-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache Pinot
 

Similar to PostgreSQL

Deep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL UniverseDeep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL UniverseJignesh Shah
 
10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks
10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks
10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech TalksAmazon Web Services
 
DAT332_How Verizon is Adopting Amazon Aurora PostgreSQL for Enterprise Workloads
DAT332_How Verizon is Adopting Amazon Aurora PostgreSQL for Enterprise WorkloadsDAT332_How Verizon is Adopting Amazon Aurora PostgreSQL for Enterprise Workloads
DAT332_How Verizon is Adopting Amazon Aurora PostgreSQL for Enterprise WorkloadsAmazon Web Services
 
Oracle & SQL Server on the Cloud: Database Week SF
Oracle & SQL Server on the Cloud: Database Week SFOracle & SQL Server on the Cloud: Database Week SF
Oracle & SQL Server on the Cloud: Database Week SFAmazon Web Services
 
Oracle & SQL Server on the Cloud: Database Week San Francisco
Oracle & SQL Server on the Cloud: Database Week San FranciscoOracle & SQL Server on the Cloud: Database Week San Francisco
Oracle & SQL Server on the Cloud: Database Week San FranciscoAmazon Web Services
 
Best Practices for Running Oracle Databases on Amazon RDS (DAT317) - AWS re:I...
Best Practices for Running Oracle Databases on Amazon RDS (DAT317) - AWS re:I...Best Practices for Running Oracle Databases on Amazon RDS (DAT317) - AWS re:I...
Best Practices for Running Oracle Databases on Amazon RDS (DAT317) - AWS re:I...Amazon Web Services
 
Getting Started with Amazon Redshift
Getting Started with Amazon RedshiftGetting Started with Amazon Redshift
Getting Started with Amazon RedshiftAmazon Web Services
 
Databases - EBC on the road Brazil Edition [Portuguese]
Databases - EBC on the road Brazil Edition [Portuguese]Databases - EBC on the road Brazil Edition [Portuguese]
Databases - EBC on the road Brazil Edition [Portuguese]Amazon Web Services
 
Oracle and SQL Server on the Cloud
Oracle and SQL Server on the CloudOracle and SQL Server on the Cloud
Oracle and SQL Server on the CloudAmazon Web Services
 
Relational Database Services on AWS - Bill Baldwin, Gareth Eagar
Relational Database Services on AWS - Bill Baldwin, Gareth EagarRelational Database Services on AWS - Bill Baldwin, Gareth Eagar
Relational Database Services on AWS - Bill Baldwin, Gareth EagarAmazon Web Services
 
Oracle and SQL Server on the Cloud - Bill Baldwin
Oracle and SQL Server on the Cloud - Bill BaldwinOracle and SQL Server on the Cloud - Bill Baldwin
Oracle and SQL Server on the Cloud - Bill BaldwinAmazon Web Services
 
Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017
Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017
Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017Amazon Web Services
 

Similar to PostgreSQL (20)

PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
 
Deep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL UniverseDeep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL Universe
 
Amazon Aurora
Amazon AuroraAmazon Aurora
Amazon Aurora
 
10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks
10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks
10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks
 
DAT332_How Verizon is Adopting Amazon Aurora PostgreSQL for Enterprise Workloads
DAT332_How Verizon is Adopting Amazon Aurora PostgreSQL for Enterprise WorkloadsDAT332_How Verizon is Adopting Amazon Aurora PostgreSQL for Enterprise Workloads
DAT332_How Verizon is Adopting Amazon Aurora PostgreSQL for Enterprise Workloads
 
Managed Relational Databases
Managed Relational DatabasesManaged Relational Databases
Managed Relational Databases
 
Oracle & SQL Server on the Cloud: Database Week SF
Oracle & SQL Server on the Cloud: Database Week SFOracle & SQL Server on the Cloud: Database Week SF
Oracle & SQL Server on the Cloud: Database Week SF
 
Oracle & SQL Server on the Cloud: Database Week San Francisco
Oracle & SQL Server on the Cloud: Database Week San FranciscoOracle & SQL Server on the Cloud: Database Week San Francisco
Oracle & SQL Server on the Cloud: Database Week San Francisco
 
Best Practices for Running Oracle Databases on Amazon RDS (DAT317) - AWS re:I...
Best Practices for Running Oracle Databases on Amazon RDS (DAT317) - AWS re:I...Best Practices for Running Oracle Databases on Amazon RDS (DAT317) - AWS re:I...
Best Practices for Running Oracle Databases on Amazon RDS (DAT317) - AWS re:I...
 
Getting Started with Amazon Redshift
Getting Started with Amazon RedshiftGetting Started with Amazon Redshift
Getting Started with Amazon Redshift
 
Databases - EBC on the road Brazil Edition [Portuguese]
Databases - EBC on the road Brazil Edition [Portuguese]Databases - EBC on the road Brazil Edition [Portuguese]
Databases - EBC on the road Brazil Edition [Portuguese]
 
Oracle and SQL Server on the Cloud
Oracle and SQL Server on the CloudOracle and SQL Server on the Cloud
Oracle and SQL Server on the Cloud
 
Relational Database Services on AWS - Bill Baldwin, Gareth Eagar
Relational Database Services on AWS - Bill Baldwin, Gareth EagarRelational Database Services on AWS - Bill Baldwin, Gareth Eagar
Relational Database Services on AWS - Bill Baldwin, Gareth Eagar
 
Amazon Aurora
Amazon AuroraAmazon Aurora
Amazon Aurora
 
Amazon Aurora
Amazon AuroraAmazon Aurora
Amazon Aurora
 
AWS Database Services @ Scale
AWS Database Services @ ScaleAWS Database Services @ Scale
AWS Database Services @ Scale
 
Amazon Aurora: Database Week SF
Amazon Aurora: Database Week SFAmazon Aurora: Database Week SF
Amazon Aurora: Database Week SF
 
Oracle and SQL Server on the Cloud - Bill Baldwin
Oracle and SQL Server on the Cloud - Bill BaldwinOracle and SQL Server on the Cloud - Bill Baldwin
Oracle and SQL Server on the Cloud - Bill Baldwin
 
MySQL and MariaDB
MySQL and MariaDBMySQL and MariaDB
MySQL and MariaDB
 
Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017
Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017
Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017
 

More from Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

PostgreSQL

  • 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved PostgreSQL Scott Mead meads@amazon.com Sr Consultant
  • 2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved What is PostgreSQL? • A Relational Database Management System • An Object Relational Database – Can add First Class simple and complex objects with methods, that can be used in a Relational Context – Queries can be made with SQL • Pronounced “POST-gress” – The “QL” is silent
  • 3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Open source database In active development for over 20 years Owned by a foundation, not a single company Permissive innovation-friendly open source license PostgreSQL Fast Facts Open Source Initiative
  • 4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved High performance out of the box Object-oriented and ANSI-SQL:2008 compatible Most geospatial features of any open-source database Supports stored procedures in 12 languages (Java, Perl, Python, Ruby, Tcl, C/C++, its own Oracle-like PL/pgSQL, and others) PostgreSQL Fast Facts
  • 5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Most Oracle-compatible open-source database Highest AWS Schema Conversion Tool automatic conversion rates are from Oracle to PostgreSQL PostgreSQL Fast Facts
  • 6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved PostgreSQL Deployment Options On-Premises Hosted Managed EC2 DB Services
  • 7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved On-Premise PostgreSQL Deployment Power, HVAC, net Rack and stack Server maintenance OS patches DB s/w patches Database backups Scaling High availability DB s/w installs OS installation you App optimization
  • 8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Hosting PostgreSQL on Amazon EC2 Power, HVAC, net Rack and stack Server maintenance OS patches DB s/w patches Database backups Scaling High availability DB s/w installs OS installation App optimization you
  • 9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Managed PostgreSQL on RDS or Aurora Power, HVAC, net Rack and stack Server maintenance OS patches DB s/w patches Database backups App optimization High availability DB s/w installs OS installation Scaling you
  • 10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved RDS: Security and Compliance • Network isolation • Database instance IP firewall protection • AWS IAM-based resource-level permission controls • Encryption at rest using AWS KMS or Oracle/Microsoft TDE • SSL protection for data in transit • Assurance programs for finance, healthcare, government, and more
  • 11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Amazon Virtual Private Cloud (Amazon VPC) Securely control network configuration Availability Zone AWS Region 10.1.0.0/16 10.1.1.0/24 Manage connectivity AWS Direct Connect VPN connection VPC peering Internet gateway Routing rules
  • 12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved RDS: IAM-Governed Access Use AWS Identity and Access Management (IAM) to control who can perform actions on Amazon RDS Users and DBAApplications DBA and Ops Your database RDS Controlled with IAMControlled with database grants
  • 13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved RDS: At-Rest Encryption • Two-tiered key hierarchy using envelope encryption • Unique data key encrypts customer data • AWS KMS master keys encrypt data keys • Available for all RDS engines • Benefits: • Limits risk of compromised data key • Better performance for encrypting large data • Easier to manage small number of master keys than millions of data keys • Centralized access and audit of key activity Leveraging AWS Key Management Service (AWS KMS) Data key 1 Data key 2 Data key 3 Data key 4 Customer master key(s) Amazon RDS instance 3 Amazon RDS instance 2 Amazon RDS instance 1
  • 14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved RDS: Compliance Singapore MTCS 27001/9001 27017/27018
  • 15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved RDS: Effortless Scaling • Scale compute/memory vertically up or down • Handle higher load to grow over time • Lower usage to control costs Storage scaling EBS Based—20 GB->6 TB & up to 30,000 IOPS Aurora Based—Up to 64 TB
  • 16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved RDS: Backup and Disaster Recovery • DB Snapshots – User-driven snapshots of database – Kept until explicitly deleted • Automated Backups – Nightly system snapshots + transaction backup – Enables point-in-time restore to any point in retention period, up to the last 5 minutes – Max retention period = 35 days • Cross region copy – Change regions – Disaster recovery
  • 17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved RDS Availability—Read and Write—Multi-AZ SecondarySecondary Primary Physical Synchronous Replication Primary AZ1 AZ2 DNS cname update Application Application Primary Update
  • 18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved RDS: Logical Replication Support • Supported with 9.6.1+, 9.5.4+ and 9.4.9+ • Set rds.logical_replication parameter to 1 • As user who has rds_replication and rds_superuser role SELECT * FROM pg_create_logical_replication_slot('test_slot', 'test_decoding'); pg_recvlogical -d postgres --slot test_slot -U master --host $rds_hostname -f - --start • Support for event triggers RDS Postgres RDS Postgres Logical Replica Redshift EC2 Postgres On Premise Postgres DMS RDS/Aurora PostgreSQL Custom Logical Handler NoSQL DB
  • 19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Amazon RDS for PostgreSQL Supporting Latest Minor Releases • 9.6.5 • 9.5.9 • 9.4.14 • 9.3.19 Now Available —PostgreSQL 10.1
  • 20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Notable Features • Support HugePages for RDS PostgreSQL • Provides performance benefit for large instances • Stop and start of RDS PostgreSQL instances • New regions supported for RDS PostgreSQL • China • Brazil • Support encryption at rest for – T2 small/medium – Cross-region Read Replicas • Flexible RI
  • 21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved New PostgreSQL Extensions Supported Extensions Description pgrouting Provides geospatial routing functionality for PostGIS postgresql-hll HyperLogLog data type support decoder_raw Output plugin to generates raw queries for logical replication changes pg_repack Remove bloat from tables and indexes in version 9.6.3 pgaudit Provide detailed session and object audit logging in versions 9.6.3 and 9.5.7 wal2json Output plugin for logical decoding in versions 9.6.3 and 9.5.7 auto_explain Log execution plans of slow statements automatically in versions 9.6.3 and 9.5.7 pg_hint_plan Provides control of execution plans by using hint phrases log_fdw Extension to query your database engine logs within the database pg_freespacemap Examine free space map
  • 22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Extension—pgaudit (9.6.3+) • CREATE ROLE rds_pgaudit • Add pgaudit to shared_preload_libraries and pgaudit.role = rds_pgaudit in a custom parameter group in PostgreSQL 9.6 family • Apply the modified parameter group to 9.6.3+ database instance and apply immediately • CREATE EXTENSION pgaudit • Grant SELECT on all tables to rds_pgaudit to enable auditing • GRANT SELECT ON t1 TO rds_pgaudit; • Database logs will show entry as follows • ... 2017-06-12 19:09:49 UTC:…:pgadmin@postgres:[11701]:LOG: AUDIT: OBJECT,1,1,READ,SELECT,TABLE,public.t1,select * from t1; ...
  • 23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Extension—pg_stat_statements • CREATE EXTENSION pg_stat_statements • SELECT * from pg_stat_statements order by total_time DESC; -[ RECORD 2 ]-------+-------- userid | 16388 dbid | 16464 queryid | 4286627671 query | UPDATE pgbench_accounts SET abalance = abalance + ? WHERE aid = ?; calls | 165125 total_time | 5251.54200000001 min_time | 0.015 max_time | 5.558 mean_time | 0.0318034337623008 stddev_time | 0.0369181019548524 rows | 165125 • SELECT substring(query, 1, 50) AS short_query, round(total_time::numeric, 2) AS total_time, calls, round(mean_time::numeric, 2) AS mean, round((100 * total_time /sum(total_time::numeric) OVER ())::numeric, 2) AS percentage_cpu FROM pg_stat_statements ORDER BY total_time DESC LIMIT 10;
  • 24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved PostgreSQL 9.6 + Amazon Aurora cloud-optimized storage  Performance: 2x–3x higher throughput than PostgreSQL alone  Availability: failover time of <30 seconds  Durability: six copies across three Availability Zones  Read Replicas: single-digit millisecond lag times on up to 15 replicas Amazon Aurora Storage Aurora PostgreSQL
  • 25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Amazon Aurora Storage Engine Overview • Data is replicated six times across three Availability Zones • Continuous backup to Amazon S3 (built for 11 9s durability) • Continuous monitoring of nodes and disks for repair • 10 GB segments as unit of repair or hotspot rebalance • Quorum system for read/write; latency tolerant • Quorum membership changes do not stall writes • Storage volume automatically grows up to 64 TB AZ 1 AZ 2 AZ 3 Amazon S3 Database Node Storage Node Storage Node Storage Node Storage Node Storage Node Storage Node Storage Monitoring
  • 26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved RDS/Aurora PostgreSQL Monitoring • Amazon CloudWatch metrics – CPU utilization – Storage – Memory – Swap usage – DB connections – I/O (read and write) – Latency (read and write) – Throughput (read and write) – Replica lag • Amazon CloudWatch alarms – Similar to on-premises monitoring tools • Enhanced Monitoring for Amazon RDS – Access to over 50 CPU, memory, file system, and disk I/O metrics – Low as 1 second intervals • Integration with third-party monitoring tools
  • 27. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Performance Insight: Simplifying Monitoring • Dashboard displaying load on database – Easy – Powerful • Identifies source of bottlenecks – Top SQL • Adjustable time frame – Hour, day, week, month – Up to 35 days of data Max CPU
  • 28. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved PostgreSQL Events and Logs
  • 29. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved CloudWatch Metric—Max Used Trans IDs
  • 30. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved aws.amazon.com/activate Everything and Anything Startups Need to Get Started on AWS