SlideShare a Scribd company logo
DBA Best Practices – 
Becoming an Exceptional 
Postgres DBA 
Marc Linster | August 27, 2014 
© 2014 EDB All rights reserved. 1
Agenda 
• EnterpriseDB Overview 
• Best Practice Expertise 
• The Postgres DBA Role 
− Monitoring 
− Maintenance 
− Capacity Planning 
− Configuration Tuning 
− Deployment Planning 
• Professional Development 
• Summary and Resources 
• Q&A 
© 2014 EnterpriseDB Corporation. All rights reserved. 2 
We will take one quick-poll 
during the webinar to 
gather group data on best 
practices of interest
Brief EDB Overview 
© 2014 EnterpriseDB Corporation. All rights reserved. 3
POSTGRES 
innovation 
Services 
& training 
© 2014 EnterpriseDB Corporation. All rights reserved. 4 
ENTERPRISE 
reliability 
24/7 
support 
Enterprise-class 
features & tools 
Indemnification 
Product 
road-map 
Control 
Thousands 
of developers 
Fast 
development 
cycles 
Low cost 
No vendor 
lock-in 
Advanced 
features 
Enabling commercial 
adoption of Postgres
Postgres Plus 
Advanced Server Postgres Plus 
Management Performance 
© 2014 EnterpriseDB Corporation. All rights reserved. 5 
Cloud Database 
High Availability 
REMOTE 
DBA 24x7 
SUPPORT 
PROFESSIONAL 
SERVICES 
TRAINING 
EDB Serves 
All Your Postgres Needs 
PostgreSQL 
Security
EDB Customers 
EDB currently has over 2,500 total customers including 50 of the Fortune 
500 and 98 of the Forbes Global 2000 
© 2014 EnterpriseDB Corporation. All rights reserved. 6
Best Practice Expertise 
© 2014 EnterpriseDB Corporation. All rights reserved. 7
Hundreds of Postgres Instances Supported 
• Remote DBA Services 
• Architectural Health Checks 
• Postgres Support Tickets 
• Postgres Training 
© 2014 EnterpriseDB Corporation. All rights reserved. 8 
When 
• ~70% support calls are at 
deployment, post-deployment 
• Remote DBA and AHC are 
post-deployment 
What 
• How to perform DBA tasks 
• Which product tools or 
features to use
When and Where do Users Need Help? 
100% 
90% 
80% 
70% 
60% 
50% 
40% 
30% 
20% 
10% 
0% 
POC Dev Deployment Maintenance 
© 2014 EnterpriseDB Corporation. All rights reserved. 9 
Tuning 
Product Awareness 
How to 
Enhancements 
Corruption 
Bug
Where Do Users Need Help 
# Tickets Phase 
Category POC Dev Deployment Maintenance Grand Total 
Connectors 0% 2% 1% 0% 3% 
Bug 0% 0% 0% 0% 1% 
How to 0% 1% 0% 0% 1% 
Product Awareness 0% 1% 0% 0% 1% 
Database 10% 9% 17% 37% 73% 
Bug 1% 2% 1% 2% 6% 
Corruption 0% 0% 0% 2% 2% 
Enhancements 0% 0% 0% 0% 1% 
How to 4% 3% 6% 
10% 
23% 
Product Awareness 4% 3% 8% 
15% 
31% 
Tuning 0% 0% 1% 7% 
9% 
Replication 1% 4% 4% 2% 12% 
Bug 0% 1% 0% 0% 2% 
How to 0% 0% 3% 1% 4% 
Product Awareness 1% 2% 1% 0% 4% 
Tuning 0% 0% 0% 1% 1% 
Utilities 1% 3% 6% 3% 12% 
Bug 0% 1% 1% 0% 2% 
Enhancements 0% 0% 0% 0% 0% 
How to 1% 1% 3% 1% 6% 
Product Awareness 0% 1% 3% 1% 5% 
Grand Total 12% 17% 28% 42% 100% 
© 2014 EnterpriseDB Corporation. All rights reserved. 10
Select Top Support and RDBA Questions 
(not in rank order) 
Deployment/Database/ 
Product Awareness & How To 
• How to set up connection 
pooling? 
• How to set up hot standby and 
streaming replica? 
• How to add table spaces? 
• How to partition? 
• How to upgrade from major 
version? 
• What should I monitor? 
• How do I reduce downtime? 
© 2014 EnterpriseDB Corporation. All rights reserved. 11 
Maintenance/Database/ 
Product Awareness & How To 
• How to find bloat in tables & 
indexes? 
• How to enable auditing 
selectively without performance 
impact? 
• What are the effects of changes 
to the values of postgresql.conf 
file parameters 
wal_writer_delay, 
bgwriter_delay? 
• What is the correct 
configuration of hba_conf?
Building Blocks of the DBA Role 
Performance 
Tuning 
Monitoring 
Maintenance 
© 2014 EnterpriseDB Corporation. All rights reserved. 12 
Capacity 
Management 
Security 
Deployment 
Training & 
Professional 
Development
The Postgres DBA Role 
© 2014 EnterpriseDB Corporation. All rights reserved. 13
Taking on the Postgres DBA Role 
• Postgres is very reliable and stable 
• You can translate your existing DBA skills to Postgres 
• Key areas for Postgres DBAs 
− Bloat management 
− Vacuum setup 
− OS configuration 
− Storage sub-system configuration 
− Backup – logical and physical 
− HA Setup 
− pg_hba.conf and other security settings 
− Monitoring 
© 2014 EDB All rights reserved. 14
Postgres DBA Role – An Approach 
• Begin with assessing the health 
of the DB - Architectural Health Check (AHC) 
− Performance 
− Maintenance Tasks – index management, bloat reduction 
− Availability – backup strategies, recovery, replication and 
failover 
− Scalability and support for business and data growth 
− Upgrade planning 
• Establish monitoring 
• Focus on list of items uncovered in health check 
© 2014 EDB All rights reserved. 15
Architectural Health Check Process 
• Technical architecture – OS, 
application, database 
• Indexes and bloat 
• Configuration tuning – OS, 
database 
− Memory 
− Write-ahead log 
− Background worker 
− Query 
− Logging 
− Checkpoint 
− Vacuum 
− Query performance 
− Security 
© 2014 EDB All rights reserved. 16 
• DR plan 
− Backup strategy – logical and physical 
− HA solutions – warm standby/log 
shipping, hot standby, streaming and 
cascading replication 
• Performance tuning 
− Reindexing 
− Partitioning 
• Resource management 
− Connections 
− CPU 
• Hardware and OS configuration 
− File system options
Monitoring and Maintenance 
© 2014 EnterpriseDB Corporation. All rights reserved. 17
Maintenance Highlights from 20+ AHCs 
Bloated Tables 
© 2014 EnterpriseDB Corporation. All rights reserved. 18 
Unused 
Indexes 
39% 
Bloated 
Indexes 
30% 
13% 
Missing 
Indexes 
9% 
Missing 
PK 
9% 
Bloat management 
(43%) is a key 
production 
problem 
specific to 
Postgres
General Monitoring Recommendations 
Description Frequency Alerting Criteria / 
Parameters monitored 
Load average, disk 
space and checking 
for .ready files 
Every 10 
minutes 
(i) When load average is above threshold 
(ii) When disk space is below threshold 
(iii) When .ready(pg_xlog/archive_status/*.ready) files 
count is beyond threshold 
Postgres instance is 
running and connection 
count 
Every minute (i) When postgres instance is not running 
(ii) When number of connection is reached to value of 
max_connections 
(iii) When number of connections crosses threshold 
Long running and 
waiting queries in 
database 
Every 10 
minutes 
(i) When any query is running for longer than threshold 
(ii) When any query is in state of "idle in transaction" for 
more than threshold 
(iii) When any query is waiting for more than threshold 
Bloats for tables and 
indexes 
Once a day (i) When database tables and/or indexes individually 
bloated more than critical threshold 
(ii) When transaction ID wrap around is approaching 
Is connection pooler 
running 
Every 10 
minutes 
If pgbouncer or pgPool process is not running 
Is streaming replication 
in sync with primary 
Every 5 
minutes 
(i) When lag detected on streaming cluster exceeds 
threshold 
© 2014 EnterpriseDB Corporation. All rights reserved. 19
Monitoring Tools (if you can’t use PEM) 
• Open source plug-in check_postgres.pl! 
− http://bucardo.org/ 
• PostgreSQL Statistics Collector - pg_stat_xxx views 
− pg_stat_activity - details of open connections and running 
transactions 
− pg_stat_database - details of databases 
− pg_stat_user_* - details of tables, indexes and functions 
− pg_locks - list of current locks being held 
• Database object size functions 
− pg_*_size - disk space used by a tablespace, database, 
relation or total_relation (includes indexes and toasted data) 
© 2014 EnterpriseDB Corporation. All rights reserved. 20
Postgres Enterprise Manager 
• Postgres Enterprise Manager (PEM) Tool 
− Monitor real-time alerts 
− Historical reports 
− Identify poorly running SQL statements 
• Top Features 
− Capacity Manager 
− Audit Manager 
− Postgres Expert 
− SQL Profiler 
− Alert Manager 
− Log Manager 
− Web Client 
− Graphical Dashboards for I/O, Memory & user activity 
© 2011 EnterpriseDB . All rights reserved. 
© 2014 EnterpriseDB Corporation. All rights reserved. 21
PEM Features 
• Global dashboards with up-to-date status (up/down/ 
performance) of all your servers 
• Ability to create performance thresholds for each key metric 
e.g. memory, storage, etc. 
• Any threshold violation results in an alert being sent to a 
centralized dashboard 
• All key performance-related statistics are automatically 
collected and retained 
• Forecast resource usage in the future 
• Identify and tune poorly running SQL statements 
• SNMP integration 
• Audit Logging for Postgres Plus Advanced Server instances 
© 2011 EnterpriseDB . All rights reserved. 
© 2014 EnterpriseDB Corporation. All rights reserved. 22
Capacity Management 
© 2014 EnterpriseDB Corporation. All rights reserved. 23
Capacity Management 
• Use cases: 
− Consumption projection: 
− At current consumption rates when will I drop below 100MB of disk? 
− At the consumption rate of the past 3 days when will I drop below 1 GB of 
disk space? 
− Point in Time Activity 
− Users were complaining of performance problems from 3 to 4 PM today. 
What was going on in the system, the database, how many users were 
connected? 
− We get a load spike every day at 11. What was happing at the time of the 
load spike? 
− Root cause for slower Query Performance 
− Queries that access the employ table seem to be taking longer and longer. 
View the growth of the number of dead tuples in the table, see what kind of 
scans have been executing against the table (index or sequential) 
− Activity monitoring 
− Which database on the server is the most active? What kind of growth is it 
seeing? 
© 2014 EnterpriseDB Corporation. All rights reserved. 24
Sample PEM Report – Disk Space Available 
© 2011 EnterpriseDB . All rights reserved. 25 
© 2014 EnterpriseDB Corporation. All rights reserved. 25 
Extrapolated 
Actual Data Data
Security 
© 2014 EnterpriseDB Corporation. All rights reserved. 26
Security Auditing 
• Conceptual Layers 
− Authentication 
− Authorization 
− Auditing 
− Data Security 
− SQL Injection Attacks 
© 2014 EnterpriseDB Corporation. All rights reserved. 27 
• Approach 
− Secure physical access 
− Network access 
limitation 
− Host access limitation 
− Database access 
limitation 
− Data access limitation
Security Best PracSetcuiricty Beest sPra ctficeos forr PoPstgreoSQsL atndg Porstgeres SPlusQ AdvaLnce d Server 
http://info.enterprisedb.com/rs/enterprisedb/images/ 
Whitepapers_Security_BP_PostgreSQL_and_Postgres_Plus_AS.pdf 
© 2014 EnterpriseDB Corporation. All rights reserved. 28 
Table of Contents 
Executive Summary ................................................................3 
Introduction ….........................................................................4 
Postgres Security Features within the Above Framework ......6 
Authentication .........................................................6 
Authorization ….......................................................7 
Accounting/Auditing ................................................8 
Data Security ….......................................................9 
SQL Injection Attacks ............................................10 
Postgres Plus Advanced Server Security Features ..............11 
Further Reading and Useful Links ........................................12 
About EnterpriseDB ..............................................................12 
Disclaimer
Quick Poll 
Database Priorities 
© 2014 EnterpriseDB Corporation. All rights reserved. 29
Audience Quick Poll #1 
• Question: What is your current database priority? 
• Answer choices: 
a. Resolving a current performance issue 
b. Architecture – migration, capacity planning, upgrade 
c. Preparing for production deployment 
d. Monitoring for ongoing database health 
e. Establishing routine maintenance practices 
© 2014 EnterpriseDB Corporation. All rights reserved. 30
Parameter Tuning for Performance 
© 2014 EnterpriseDB Corporation. All rights reserved. 31
Lessons From AHC and RDBA 
Performance Improvement Recommendations in: 
• Optimizing memory usage 
− Adjusting shared_buffers 
− work_mem * max_connections 
• vm.dirty_bytes and vm.dirty_background_bytes 
• Understanding the storage 
− effective_io_concurrency 
• Identifying problem queries - pgbadger and SQL 
Profiler 
The following analysis is based on a set of 20 AHCs 
executed in 2013 
© 2014 EnterpriseDB Corporation. All rights reserved. 32
100%# 
90%# 
80%# 
70%# 
60%# 
50%# 
40%# 
30%# 
20%# 
10%# 
0%# 
Top Database Parameter Adjustments – Ordered by Frequency 
effec0ve_cache_size# 
Top$Database$Parameter$Adjustments$3$Ordered$by$Frequency$ 
wal_buffers# 
maintenance_work_mem# 
shared_buffers# 
bgwriter_lru_maxpages# 
work_mem# 
random_page_cost# 
checkpoint_segments# 
cpu_tuple_cost# 
checkpoint_comple0on_target# 
bgwriter_lru_mul0plier# 
Red bars: 
experts expected top parameters, 
including vacuum_cost_limit, 
log_line_prefix, 
log_min_duration_statement, 
log_checkpoints 
checkpoint_warning# 
autovacuum_vacuum_cost_delay# 
autovacuum_vacuum_threshold# 
log_min_dura0on_statement# 
autovacuum_vacuum_scale_factor# 
checkpoint_0meout# 
© 2014 EnterpriseDB Corporation. All rights reserved. 33 
log_line_prefix# 
log_lock_waits# 
autovacuum_nap0me# 
log_autovacuum_min_dura0on#
Kernel Parameters 
16 
14 
12 
10 
8 
6 
4 
2 
0 
© 2014 EnterpriseDB Corporation. All rights reserved. 34
Customer Case Study 
Use Case: Supply Chain Logistics IT Provider 
SaaS Warehouse Management System 
Issue: 
• Performance issues - speed 
Root Causes 
• Slow, memory-hungry queries, 
improper indexes 
Results 
© 2014 EnterpriseDB Corporation. All rights reserved. 35 
Change Areas 
• Indexing improvements 
• Query tuning or rewrites
Customer Case Study 
Use Case: Global MLS Platform – Reporting System 
Issue: 
• Intermittent timeouts 
Root Cause 
• Parameter configuration 
• Enabled 
− vm.dirty_bytes 
− vm.dirty_background_bytes 
− vm.zone_reclaim_mode 
• Disabled 
− vm.overcommit_memory 
− vm.swappiness 
− redhat_transparent_hugepage 
© 2014 EnterpriseDB Corporation. All rights reserved. 36 
Change Areas 
• Kernel parameters 
• Database memory parameters 
• Increased 
− work_mem 
− maintenance_work_mem 
• Reduced 
− shared_buffers 
• wal_buffers 32MB 
• wal_level “archive”
Deployment Planning 
© 2014 EnterpriseDB Corporation. All rights reserved. 37
Backup and Recovery Strategies 
• Why do you need backup and recovery? Backup and 
Recovery Strategies protect you in case of: 
− Catastrophic Device Failure 
− Site Failure 
− Maintenance 
− Operator Error 
− Compliance 
− Data Corruption 
• Multiple components: 
− Logical backup provides granularity in objects (tables, table 
spaces, databases) 
− Physical backups provide granularity in time for PITR 
− Cold/off-line backups 
− Hot/on-line backup, with WAL archiving 
© 2014 EnterpriseDB Corporation. All rights reserved. 38
Backup and Standby 
Snapshot 
Backup Approach 
© 2014 EnterpriseDB Corporation. All rights reserved. 39 
Standby Approach 
hot 
47% 
None 
18% 
cold 
12% 
warm 
23% 
Physical 
Only 
36% 
Logical 
Only 
29% 
FS 
7% 
Physical 
and 
Logical 
14% 
None 
14% 
43% of customers could not execute 
PITR (prior to AHC) – some had NO 
backup in place 
30% of customers would have been 
slow or unable to recover from failure
Backup and Recovery Best Practices 
• Backup Strategy Framework 
− Logical backup after structural changes or 
major updates of reference/meta data 
− Physical backup (daily…) 
− WAL file archiving 
− Combine Backup/Recovery and Streaming Replication 
− Uses replica to offload hot backup and logical backup 
• Consider 
− Allowable PITR timeframe 
− Data retention policy 
− Test, test, test 
− Periodic backup validation 
• Advanced solutions, such as RHCS, Veritas Clustering , EFM and 
EDB BART augment the basic capabilities 
© 2014 EnterpriseDB Corporation. All rights reserved. 40
Customer Case Study 
Use Case: on-line advertising service with hosted chat 
Stage: post-production 
Primary Issue: 
• Outage due to replication 
failure - insufficient log info to 
determine true root cause 
Potential Pain Points 
• Concerns have reached limits 
of scale and meeting 
anticipated growth demands 
© 2014 EnterpriseDB Corporation. All rights reserved. 41 
Recommendations 
• Backup and recovery strategies 
− Implement continuous archive 
recovery in addition to 
streaming replication 
− Revised backup strategy with 
PITR 
− Tune auto-vacuum settings and 
manually vacuum large tables 
• Indexes – create concurrent 
indexes, REINDEX to reduce bloat 
• Parameter tuning – various for 
kernel, memory settings and WALs
File System and Storage Subsystem 
• Types of Storage Systems 
− Direct Attached Storage (DAS) 
− Storage Area Network (SAN) w. Fiber Channel 
− Storage Area Network (SAN) w. iSCSI 
− Network File System (NFS) 
• DAS: Fast and low latency 
• SAN: Fast, expensive (w. Fiber Channel), scalable, can 
include redundancy and smart file system operations 
• NFS: Not an optimal solution for PostgreSQL data files 
© 2014 EnterpriseDB Corporation. All rights reserved. 42
Summary and Useful Resources 
© 2014 EnterpriseDB Corporation. All rights reserved. 43
Summary 
• Postgres DBAs need to focus on 
− Config file settings, especially understanding memory configs 
− Storage subsystem configuration 
− OS Configuration 
− Bloat & vacuum 
− Backup - logical and physical 
− HA setup 
− Monitoring - see the Freight Train before it hits you! 
• Tools, tools, tools – Get the right tools 
• Most problems occur when moving to production 
− Get ready early 
− Get trained before MTP 
− New Postgres DBA -- consider RDBA to help you get started 
© 2014 EnterpriseDB Corporation. All rights reserved. 44
What You Can Do 
• Training & Certification 
− Classroom Comprehensive Admin - Bangalore – Sept 15-19 
− Comprehensive Admin Live Online – NA- with Bruce Momjian – PostgreSQL Guru 
and community leader – Oct 6-10 
− Live Online EMEA – Adv. PostgreSQL Admin – with 9.4 Highlights – Oct 13-15 
• Get the team (developer, DBA, Infrastructure) ready to thrive with Postgres 
• EDB Knowledge Base 
• Blogs 
− Robert Haas – EDB Chief Architect Database Server (http://rhaas.blogspot.com/) 
− Vibhor Kumar – EDB Database Consultant (http://vibhorkumar.wordpress.com/) 
• User groups and Meetups – almost all major cities 
− http://www.postgresql.org/community/user-groups/ 
− http://postgresql.meetup.com/ 
• PostgresOpen 2014 - Sept 17-19 Chicago 
• PostgreSQL Conference Europe 2014 - Oct 21-24 Madrid 
© 2014 EnterpriseDB Corporation. All rights reserved. 45
Architectural 
Health Check 
• Review of 
database, 
OS, env. 
settings 
• Guidance on 
tuning, 
backup, high 
availability 
strategies 
Remote DBA 
Services 
• 24 x 7 
monitoring 
• Supplemental 
staff 
• Architectural 
health check 
• Access to 
Postgres 
expertise 
© 2014 EnterpriseDB Corporation. All rights reserved. 46 
Kick Start 
• Training 
• Flex 
consulting 
• Developer 
subscription 
Training and 
Certification 
• Flexible 
formats: 
on-demand, 
live virtual, 
on-site 
• Continuing 
education 
and Postgres 
certification 
How We Can Help 
Whitepapers and Recorded Webinars 
http://www.enterprisedb.com/resources-community
Special Offers for Attendees 
For all attendees we are providing a special offer on related DBA 
services including training. 
Please complete an inquiry form on-line and mention this webinar, or 
speak to your account manager 
− EDB’s regional sales offices found on enterprisedb.com: 
− US +1 781-357-3390 or 1-877-377-4352 
− EMEA +31 (0) 70 36 11 774 
− JAPAN +81-50-5532-7038 
− KOREA +82-2-6007-2500 
− PAKISTAN +92-51-8358874 
− INDIA +91-20-30589500/01 
− Send email to sales@enterprisedb.com 
− http://www.enterprisedb.com/general-inquiry-form 
© 2014 EnterpriseDB Corporation. All rights reserved. 47
Q&A 
© 2014 EnterpriseDB Corporation. All rights reserved. 48

More Related Content

What's hot (20)

PDF
Postgresql database administration volume 1
Federico Campoli
 
PDF
Understanding Memory Management In Spark For Fun And Profit
Spark Summit
 
PDF
Introduction SQL Analytics on Lakehouse Architecture
Databricks
 
PDF
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
The Hive
 
PDF
Voldemort Nosql
elliando dias
 
PDF
Growing the Delta Ecosystem to Rust and Python with Delta-RS
Databricks
 
PDF
Best Practice of Compression/Decompression Codes in Apache Spark with Sophia...
Databricks
 
PDF
MyRocks Deep Dive
Yoshinori Matsunobu
 
PPTX
Free Training: How to Build a Lakehouse
Databricks
 
PDF
Amazon S3 Best Practice and Tuning for Hadoop/Spark in the Cloud
Noritaka Sekiyama
 
PPTX
HBase and HDFS: Understanding FileSystem Usage in HBase
enissoz
 
PPTX
Using Kafka and Kudu for fast, low-latency SQL analytics on streaming data
Mike Percy
 
PDF
Apache Iceberg - A Table Format for Hige Analytic Datasets
Alluxio, Inc.
 
PDF
Getting Started with Delta Lake on Databricks
Knoldus Inc.
 
PPTX
Moving Beyond Lambda Architectures with Apache Kudu
Cloudera, Inc.
 
PPTX
Spark introduction and architecture
Sohil Jain
 
PDF
Spark Performance Tuning .pdf
Amit Raj
 
PPTX
Voldemort
fasiha ikram
 
PDF
Building a Logical Data Fabric using Data Virtualization (ASEAN)
Denodo
 
PDF
MySQL Administrator 2021 - 네오클로바
NeoClova
 
Postgresql database administration volume 1
Federico Campoli
 
Understanding Memory Management In Spark For Fun And Profit
Spark Summit
 
Introduction SQL Analytics on Lakehouse Architecture
Databricks
 
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
The Hive
 
Voldemort Nosql
elliando dias
 
Growing the Delta Ecosystem to Rust and Python with Delta-RS
Databricks
 
Best Practice of Compression/Decompression Codes in Apache Spark with Sophia...
Databricks
 
MyRocks Deep Dive
Yoshinori Matsunobu
 
Free Training: How to Build a Lakehouse
Databricks
 
Amazon S3 Best Practice and Tuning for Hadoop/Spark in the Cloud
Noritaka Sekiyama
 
HBase and HDFS: Understanding FileSystem Usage in HBase
enissoz
 
Using Kafka and Kudu for fast, low-latency SQL analytics on streaming data
Mike Percy
 
Apache Iceberg - A Table Format for Hige Analytic Datasets
Alluxio, Inc.
 
Getting Started with Delta Lake on Databricks
Knoldus Inc.
 
Moving Beyond Lambda Architectures with Apache Kudu
Cloudera, Inc.
 
Spark introduction and architecture
Sohil Jain
 
Spark Performance Tuning .pdf
Amit Raj
 
Voldemort
fasiha ikram
 
Building a Logical Data Fabric using Data Virtualization (ASEAN)
Denodo
 
MySQL Administrator 2021 - 네오클로바
NeoClova
 

Viewers also liked (7)

PDF
Best Practices for a Complete Postgres Enterprise Architecture Setup
EDB
 
PDF
Essential Linux Commands for DBAs
Gokhan Atil
 
PDF
MySQL Sharding: Tools and Best Practices for Horizontal Scaling
Mats Kindahl
 
PPTX
MySQL Options in OpenStack
Tesora
 
PDF
Postgres in Production - Best Practices 2014
EDB
 
PDF
5 Steps to PostgreSQL Performance
Command Prompt., Inc
 
PDF
High Availability for OpenStack
Kamesh Pemmaraju
 
Best Practices for a Complete Postgres Enterprise Architecture Setup
EDB
 
Essential Linux Commands for DBAs
Gokhan Atil
 
MySQL Sharding: Tools and Best Practices for Horizontal Scaling
Mats Kindahl
 
MySQL Options in OpenStack
Tesora
 
Postgres in Production - Best Practices 2014
EDB
 
5 Steps to PostgreSQL Performance
Command Prompt., Inc
 
High Availability for OpenStack
Kamesh Pemmaraju
 
Ad

Similar to Best Practices for Becoming an Exceptional Postgres DBA (20)

PDF
EnterpriseDB's Best Practices for Postgres DBAs
EDB
 
PPTX
Postgres in production.2014
EDB
 
PPTX
Tales from the Postgres Front - and What We Can Learn
EDB
 
PPTX
Migrations, Health Checks, and Support Experiences - Postgres from the Servic...
EDB
 
PDF
Tapping into New Postgres Resources with Remote DBAs
EDB
 
PDF
Best Practices for Monitoring Postgres
EDB
 
PDF
5 Postgres DBA Tips
EDB
 
PDF
Using PEM to understand and improve performance in Postgres: Postgres Tuning ...
EDB
 
PPTX
How to Monitor Postgres Like a Pro!
EDB
 
PDF
Remote DBA Service: Powering your DBA needs
EDB
 
PPTX
Remote DBA Service: Powering your DBA needs
EDB
 
PDF
Optimizing Your Postgres ROI Through Best Practices
EDB
 
PDF
5 Tips to Simplify the Management of Your Postgres Database
EDB
 
PDF
Enterprise PostgreSQL - EDB's answer to conventional Databases
Ashnikbiz
 
PPTX
PostgreSQL as a Strategic Tool
EDB
 
PDF
Top10 list planningpostgresdeployment.2014
EDB
 
PPTX
New enhancements for security and usability in EDB 13
EDB
 
PDF
Top 10 Tips for an Effective Postgres Deployment
EDB
 
PDF
Minimize Headaches with Your Postgres Deployment
EDB
 
PDF
Optimizing Open Source for Greater Database Savings & Control
EDB
 
EnterpriseDB's Best Practices for Postgres DBAs
EDB
 
Postgres in production.2014
EDB
 
Tales from the Postgres Front - and What We Can Learn
EDB
 
Migrations, Health Checks, and Support Experiences - Postgres from the Servic...
EDB
 
Tapping into New Postgres Resources with Remote DBAs
EDB
 
Best Practices for Monitoring Postgres
EDB
 
5 Postgres DBA Tips
EDB
 
Using PEM to understand and improve performance in Postgres: Postgres Tuning ...
EDB
 
How to Monitor Postgres Like a Pro!
EDB
 
Remote DBA Service: Powering your DBA needs
EDB
 
Remote DBA Service: Powering your DBA needs
EDB
 
Optimizing Your Postgres ROI Through Best Practices
EDB
 
5 Tips to Simplify the Management of Your Postgres Database
EDB
 
Enterprise PostgreSQL - EDB's answer to conventional Databases
Ashnikbiz
 
PostgreSQL as a Strategic Tool
EDB
 
Top10 list planningpostgresdeployment.2014
EDB
 
New enhancements for security and usability in EDB 13
EDB
 
Top 10 Tips for an Effective Postgres Deployment
EDB
 
Minimize Headaches with Your Postgres Deployment
EDB
 
Optimizing Open Source for Greater Database Savings & Control
EDB
 
Ad

More from EDB (20)

PDF
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
EDB
 
PDF
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
EDB
 
PDF
Migre sus bases de datos Oracle a la nube
EDB
 
PDF
EFM Office Hours - APJ - July 29, 2021
EDB
 
PDF
Benchmarking Cloud Native PostgreSQL
EDB
 
PDF
Las Variaciones de la Replicación de PostgreSQL
EDB
 
PDF
NoSQL and Spatial Database Capabilities using PostgreSQL
EDB
 
PDF
Is There Anything PgBouncer Can’t Do?
EDB
 
PDF
Data Analysis with TensorFlow in PostgreSQL
EDB
 
PDF
Practical Partitioning in Production with Postgres
EDB
 
PDF
A Deeper Dive into EXPLAIN
EDB
 
PDF
IOT with PostgreSQL
EDB
 
PDF
A Journey from Oracle to PostgreSQL
EDB
 
PDF
Psql is awesome!
EDB
 
PDF
EDB 13 - New Enhancements for Security and Usability - APJ
EDB
 
PPTX
Comment sauvegarder correctement vos données
EDB
 
PDF
Cloud Native PostgreSQL - Italiano
EDB
 
PDF
New enhancements for security and usability in EDB 13
EDB
 
PPTX
Best Practices in Security with PostgreSQL
EDB
 
PDF
Cloud Native PostgreSQL - APJ
EDB
 
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
EDB
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
EDB
 
Migre sus bases de datos Oracle a la nube
EDB
 
EFM Office Hours - APJ - July 29, 2021
EDB
 
Benchmarking Cloud Native PostgreSQL
EDB
 
Las Variaciones de la Replicación de PostgreSQL
EDB
 
NoSQL and Spatial Database Capabilities using PostgreSQL
EDB
 
Is There Anything PgBouncer Can’t Do?
EDB
 
Data Analysis with TensorFlow in PostgreSQL
EDB
 
Practical Partitioning in Production with Postgres
EDB
 
A Deeper Dive into EXPLAIN
EDB
 
IOT with PostgreSQL
EDB
 
A Journey from Oracle to PostgreSQL
EDB
 
Psql is awesome!
EDB
 
EDB 13 - New Enhancements for Security and Usability - APJ
EDB
 
Comment sauvegarder correctement vos données
EDB
 
Cloud Native PostgreSQL - Italiano
EDB
 
New enhancements for security and usability in EDB 13
EDB
 
Best Practices in Security with PostgreSQL
EDB
 
Cloud Native PostgreSQL - APJ
EDB
 

Recently uploaded (20)

PPTX
Plant Growth and Development-Part I, ppt.pptx
7300511143
 
PPTX
social problem, pathology,security.pptxs
krishnaleuva45
 
PPTX
carbohydrates-230715125628-fbb297d6.pptx
pankajkushwah29
 
PPTX
一比一原版(UWS毕业证)西苏格兰大学毕业证如何办理
Taqyea
 
PPTX
Mastering the Cloud with AWS: A Deep Dive into Amazon Web Services
cbitssnavjotdm
 
PDF
Buy Twitter Accounts_ Boost Your Brand and Reach in 2025 - Copy - Copy.pdf
Buy Old Twitter Accounts-100% Secure Aged With Followers
 
PPTX
Canopy Manipulation For Optimum Utilization of Light.pptx
vishalpatidar74
 
PPTX
Grade 3-CVCC Words for educational purposes only.pptx
franciaadiova
 
PDF
Biography and career history of Neil Druker
Neil Druker
 
PDF
Find better job with us- Formwalaa, your career partner
Reeshna Prajeesh
 
PDF
VisionIAS - UPSC GS Paper I Question Paper 2025 with Answer Key.pdf
saxenashubh937
 
PDF
2025 - KPT - The best people are those you can't buy - Beata Mosór.pdf
bmosor
 
PPT
bgasslideshow-141208014132-conversion-gate02 (1).ppt
mninspection1
 
PPTX
ASHISH SINGH New PPT (1).pptxASHISH SINGH New PPT (1).pptxASHISH SINGH New PP...
ShivanshPratapSingh5
 
PPTX
Water managements in Fruit Crops for PG Students of Agriculture.pptx
7300511143
 
PDF
REFRIGERATION THANDA AND AIR PABANA PATHA PADHE
AjitBiswal14
 
PPTX
Mastering-Language-Learning-at-MIS-International-School.pptx
ambarguptaaconsultan
 
PPTX
Chemistry-Presentation-The-World-of-Silicates.pptx
swethasejal123
 
PPTX
SPCEufudufufufutigifiyifurkfitifjgjf-1.pptx
71762306019
 
PPTX
Learn AI in Software Testing - Venkatesh (Rahul Shetty)
Venkatesh (Rahul Shetty)
 
Plant Growth and Development-Part I, ppt.pptx
7300511143
 
social problem, pathology,security.pptxs
krishnaleuva45
 
carbohydrates-230715125628-fbb297d6.pptx
pankajkushwah29
 
一比一原版(UWS毕业证)西苏格兰大学毕业证如何办理
Taqyea
 
Mastering the Cloud with AWS: A Deep Dive into Amazon Web Services
cbitssnavjotdm
 
Buy Twitter Accounts_ Boost Your Brand and Reach in 2025 - Copy - Copy.pdf
Buy Old Twitter Accounts-100% Secure Aged With Followers
 
Canopy Manipulation For Optimum Utilization of Light.pptx
vishalpatidar74
 
Grade 3-CVCC Words for educational purposes only.pptx
franciaadiova
 
Biography and career history of Neil Druker
Neil Druker
 
Find better job with us- Formwalaa, your career partner
Reeshna Prajeesh
 
VisionIAS - UPSC GS Paper I Question Paper 2025 with Answer Key.pdf
saxenashubh937
 
2025 - KPT - The best people are those you can't buy - Beata Mosór.pdf
bmosor
 
bgasslideshow-141208014132-conversion-gate02 (1).ppt
mninspection1
 
ASHISH SINGH New PPT (1).pptxASHISH SINGH New PPT (1).pptxASHISH SINGH New PP...
ShivanshPratapSingh5
 
Water managements in Fruit Crops for PG Students of Agriculture.pptx
7300511143
 
REFRIGERATION THANDA AND AIR PABANA PATHA PADHE
AjitBiswal14
 
Mastering-Language-Learning-at-MIS-International-School.pptx
ambarguptaaconsultan
 
Chemistry-Presentation-The-World-of-Silicates.pptx
swethasejal123
 
SPCEufudufufufutigifiyifurkfitifjgjf-1.pptx
71762306019
 
Learn AI in Software Testing - Venkatesh (Rahul Shetty)
Venkatesh (Rahul Shetty)
 

Best Practices for Becoming an Exceptional Postgres DBA

  • 1. DBA Best Practices – Becoming an Exceptional Postgres DBA Marc Linster | August 27, 2014 © 2014 EDB All rights reserved. 1
  • 2. Agenda • EnterpriseDB Overview • Best Practice Expertise • The Postgres DBA Role − Monitoring − Maintenance − Capacity Planning − Configuration Tuning − Deployment Planning • Professional Development • Summary and Resources • Q&A © 2014 EnterpriseDB Corporation. All rights reserved. 2 We will take one quick-poll during the webinar to gather group data on best practices of interest
  • 3. Brief EDB Overview © 2014 EnterpriseDB Corporation. All rights reserved. 3
  • 4. POSTGRES innovation Services & training © 2014 EnterpriseDB Corporation. All rights reserved. 4 ENTERPRISE reliability 24/7 support Enterprise-class features & tools Indemnification Product road-map Control Thousands of developers Fast development cycles Low cost No vendor lock-in Advanced features Enabling commercial adoption of Postgres
  • 5. Postgres Plus Advanced Server Postgres Plus Management Performance © 2014 EnterpriseDB Corporation. All rights reserved. 5 Cloud Database High Availability REMOTE DBA 24x7 SUPPORT PROFESSIONAL SERVICES TRAINING EDB Serves All Your Postgres Needs PostgreSQL Security
  • 6. EDB Customers EDB currently has over 2,500 total customers including 50 of the Fortune 500 and 98 of the Forbes Global 2000 © 2014 EnterpriseDB Corporation. All rights reserved. 6
  • 7. Best Practice Expertise © 2014 EnterpriseDB Corporation. All rights reserved. 7
  • 8. Hundreds of Postgres Instances Supported • Remote DBA Services • Architectural Health Checks • Postgres Support Tickets • Postgres Training © 2014 EnterpriseDB Corporation. All rights reserved. 8 When • ~70% support calls are at deployment, post-deployment • Remote DBA and AHC are post-deployment What • How to perform DBA tasks • Which product tools or features to use
  • 9. When and Where do Users Need Help? 100% 90% 80% 70% 60% 50% 40% 30% 20% 10% 0% POC Dev Deployment Maintenance © 2014 EnterpriseDB Corporation. All rights reserved. 9 Tuning Product Awareness How to Enhancements Corruption Bug
  • 10. Where Do Users Need Help # Tickets Phase Category POC Dev Deployment Maintenance Grand Total Connectors 0% 2% 1% 0% 3% Bug 0% 0% 0% 0% 1% How to 0% 1% 0% 0% 1% Product Awareness 0% 1% 0% 0% 1% Database 10% 9% 17% 37% 73% Bug 1% 2% 1% 2% 6% Corruption 0% 0% 0% 2% 2% Enhancements 0% 0% 0% 0% 1% How to 4% 3% 6% 10% 23% Product Awareness 4% 3% 8% 15% 31% Tuning 0% 0% 1% 7% 9% Replication 1% 4% 4% 2% 12% Bug 0% 1% 0% 0% 2% How to 0% 0% 3% 1% 4% Product Awareness 1% 2% 1% 0% 4% Tuning 0% 0% 0% 1% 1% Utilities 1% 3% 6% 3% 12% Bug 0% 1% 1% 0% 2% Enhancements 0% 0% 0% 0% 0% How to 1% 1% 3% 1% 6% Product Awareness 0% 1% 3% 1% 5% Grand Total 12% 17% 28% 42% 100% © 2014 EnterpriseDB Corporation. All rights reserved. 10
  • 11. Select Top Support and RDBA Questions (not in rank order) Deployment/Database/ Product Awareness & How To • How to set up connection pooling? • How to set up hot standby and streaming replica? • How to add table spaces? • How to partition? • How to upgrade from major version? • What should I monitor? • How do I reduce downtime? © 2014 EnterpriseDB Corporation. All rights reserved. 11 Maintenance/Database/ Product Awareness & How To • How to find bloat in tables & indexes? • How to enable auditing selectively without performance impact? • What are the effects of changes to the values of postgresql.conf file parameters wal_writer_delay, bgwriter_delay? • What is the correct configuration of hba_conf?
  • 12. Building Blocks of the DBA Role Performance Tuning Monitoring Maintenance © 2014 EnterpriseDB Corporation. All rights reserved. 12 Capacity Management Security Deployment Training & Professional Development
  • 13. The Postgres DBA Role © 2014 EnterpriseDB Corporation. All rights reserved. 13
  • 14. Taking on the Postgres DBA Role • Postgres is very reliable and stable • You can translate your existing DBA skills to Postgres • Key areas for Postgres DBAs − Bloat management − Vacuum setup − OS configuration − Storage sub-system configuration − Backup – logical and physical − HA Setup − pg_hba.conf and other security settings − Monitoring © 2014 EDB All rights reserved. 14
  • 15. Postgres DBA Role – An Approach • Begin with assessing the health of the DB - Architectural Health Check (AHC) − Performance − Maintenance Tasks – index management, bloat reduction − Availability – backup strategies, recovery, replication and failover − Scalability and support for business and data growth − Upgrade planning • Establish monitoring • Focus on list of items uncovered in health check © 2014 EDB All rights reserved. 15
  • 16. Architectural Health Check Process • Technical architecture – OS, application, database • Indexes and bloat • Configuration tuning – OS, database − Memory − Write-ahead log − Background worker − Query − Logging − Checkpoint − Vacuum − Query performance − Security © 2014 EDB All rights reserved. 16 • DR plan − Backup strategy – logical and physical − HA solutions – warm standby/log shipping, hot standby, streaming and cascading replication • Performance tuning − Reindexing − Partitioning • Resource management − Connections − CPU • Hardware and OS configuration − File system options
  • 17. Monitoring and Maintenance © 2014 EnterpriseDB Corporation. All rights reserved. 17
  • 18. Maintenance Highlights from 20+ AHCs Bloated Tables © 2014 EnterpriseDB Corporation. All rights reserved. 18 Unused Indexes 39% Bloated Indexes 30% 13% Missing Indexes 9% Missing PK 9% Bloat management (43%) is a key production problem specific to Postgres
  • 19. General Monitoring Recommendations Description Frequency Alerting Criteria / Parameters monitored Load average, disk space and checking for .ready files Every 10 minutes (i) When load average is above threshold (ii) When disk space is below threshold (iii) When .ready(pg_xlog/archive_status/*.ready) files count is beyond threshold Postgres instance is running and connection count Every minute (i) When postgres instance is not running (ii) When number of connection is reached to value of max_connections (iii) When number of connections crosses threshold Long running and waiting queries in database Every 10 minutes (i) When any query is running for longer than threshold (ii) When any query is in state of "idle in transaction" for more than threshold (iii) When any query is waiting for more than threshold Bloats for tables and indexes Once a day (i) When database tables and/or indexes individually bloated more than critical threshold (ii) When transaction ID wrap around is approaching Is connection pooler running Every 10 minutes If pgbouncer or pgPool process is not running Is streaming replication in sync with primary Every 5 minutes (i) When lag detected on streaming cluster exceeds threshold © 2014 EnterpriseDB Corporation. All rights reserved. 19
  • 20. Monitoring Tools (if you can’t use PEM) • Open source plug-in check_postgres.pl! − http://bucardo.org/ • PostgreSQL Statistics Collector - pg_stat_xxx views − pg_stat_activity - details of open connections and running transactions − pg_stat_database - details of databases − pg_stat_user_* - details of tables, indexes and functions − pg_locks - list of current locks being held • Database object size functions − pg_*_size - disk space used by a tablespace, database, relation or total_relation (includes indexes and toasted data) © 2014 EnterpriseDB Corporation. All rights reserved. 20
  • 21. Postgres Enterprise Manager • Postgres Enterprise Manager (PEM) Tool − Monitor real-time alerts − Historical reports − Identify poorly running SQL statements • Top Features − Capacity Manager − Audit Manager − Postgres Expert − SQL Profiler − Alert Manager − Log Manager − Web Client − Graphical Dashboards for I/O, Memory & user activity © 2011 EnterpriseDB . All rights reserved. © 2014 EnterpriseDB Corporation. All rights reserved. 21
  • 22. PEM Features • Global dashboards with up-to-date status (up/down/ performance) of all your servers • Ability to create performance thresholds for each key metric e.g. memory, storage, etc. • Any threshold violation results in an alert being sent to a centralized dashboard • All key performance-related statistics are automatically collected and retained • Forecast resource usage in the future • Identify and tune poorly running SQL statements • SNMP integration • Audit Logging for Postgres Plus Advanced Server instances © 2011 EnterpriseDB . All rights reserved. © 2014 EnterpriseDB Corporation. All rights reserved. 22
  • 23. Capacity Management © 2014 EnterpriseDB Corporation. All rights reserved. 23
  • 24. Capacity Management • Use cases: − Consumption projection: − At current consumption rates when will I drop below 100MB of disk? − At the consumption rate of the past 3 days when will I drop below 1 GB of disk space? − Point in Time Activity − Users were complaining of performance problems from 3 to 4 PM today. What was going on in the system, the database, how many users were connected? − We get a load spike every day at 11. What was happing at the time of the load spike? − Root cause for slower Query Performance − Queries that access the employ table seem to be taking longer and longer. View the growth of the number of dead tuples in the table, see what kind of scans have been executing against the table (index or sequential) − Activity monitoring − Which database on the server is the most active? What kind of growth is it seeing? © 2014 EnterpriseDB Corporation. All rights reserved. 24
  • 25. Sample PEM Report – Disk Space Available © 2011 EnterpriseDB . All rights reserved. 25 © 2014 EnterpriseDB Corporation. All rights reserved. 25 Extrapolated Actual Data Data
  • 26. Security © 2014 EnterpriseDB Corporation. All rights reserved. 26
  • 27. Security Auditing • Conceptual Layers − Authentication − Authorization − Auditing − Data Security − SQL Injection Attacks © 2014 EnterpriseDB Corporation. All rights reserved. 27 • Approach − Secure physical access − Network access limitation − Host access limitation − Database access limitation − Data access limitation
  • 28. Security Best PracSetcuiricty Beest sPra ctficeos forr PoPstgreoSQsL atndg Porstgeres SPlusQ AdvaLnce d Server http://info.enterprisedb.com/rs/enterprisedb/images/ Whitepapers_Security_BP_PostgreSQL_and_Postgres_Plus_AS.pdf © 2014 EnterpriseDB Corporation. All rights reserved. 28 Table of Contents Executive Summary ................................................................3 Introduction ….........................................................................4 Postgres Security Features within the Above Framework ......6 Authentication .........................................................6 Authorization ….......................................................7 Accounting/Auditing ................................................8 Data Security ….......................................................9 SQL Injection Attacks ............................................10 Postgres Plus Advanced Server Security Features ..............11 Further Reading and Useful Links ........................................12 About EnterpriseDB ..............................................................12 Disclaimer
  • 29. Quick Poll Database Priorities © 2014 EnterpriseDB Corporation. All rights reserved. 29
  • 30. Audience Quick Poll #1 • Question: What is your current database priority? • Answer choices: a. Resolving a current performance issue b. Architecture – migration, capacity planning, upgrade c. Preparing for production deployment d. Monitoring for ongoing database health e. Establishing routine maintenance practices © 2014 EnterpriseDB Corporation. All rights reserved. 30
  • 31. Parameter Tuning for Performance © 2014 EnterpriseDB Corporation. All rights reserved. 31
  • 32. Lessons From AHC and RDBA Performance Improvement Recommendations in: • Optimizing memory usage − Adjusting shared_buffers − work_mem * max_connections • vm.dirty_bytes and vm.dirty_background_bytes • Understanding the storage − effective_io_concurrency • Identifying problem queries - pgbadger and SQL Profiler The following analysis is based on a set of 20 AHCs executed in 2013 © 2014 EnterpriseDB Corporation. All rights reserved. 32
  • 33. 100%# 90%# 80%# 70%# 60%# 50%# 40%# 30%# 20%# 10%# 0%# Top Database Parameter Adjustments – Ordered by Frequency effec0ve_cache_size# Top$Database$Parameter$Adjustments$3$Ordered$by$Frequency$ wal_buffers# maintenance_work_mem# shared_buffers# bgwriter_lru_maxpages# work_mem# random_page_cost# checkpoint_segments# cpu_tuple_cost# checkpoint_comple0on_target# bgwriter_lru_mul0plier# Red bars: experts expected top parameters, including vacuum_cost_limit, log_line_prefix, log_min_duration_statement, log_checkpoints checkpoint_warning# autovacuum_vacuum_cost_delay# autovacuum_vacuum_threshold# log_min_dura0on_statement# autovacuum_vacuum_scale_factor# checkpoint_0meout# © 2014 EnterpriseDB Corporation. All rights reserved. 33 log_line_prefix# log_lock_waits# autovacuum_nap0me# log_autovacuum_min_dura0on#
  • 34. Kernel Parameters 16 14 12 10 8 6 4 2 0 © 2014 EnterpriseDB Corporation. All rights reserved. 34
  • 35. Customer Case Study Use Case: Supply Chain Logistics IT Provider SaaS Warehouse Management System Issue: • Performance issues - speed Root Causes • Slow, memory-hungry queries, improper indexes Results © 2014 EnterpriseDB Corporation. All rights reserved. 35 Change Areas • Indexing improvements • Query tuning or rewrites
  • 36. Customer Case Study Use Case: Global MLS Platform – Reporting System Issue: • Intermittent timeouts Root Cause • Parameter configuration • Enabled − vm.dirty_bytes − vm.dirty_background_bytes − vm.zone_reclaim_mode • Disabled − vm.overcommit_memory − vm.swappiness − redhat_transparent_hugepage © 2014 EnterpriseDB Corporation. All rights reserved. 36 Change Areas • Kernel parameters • Database memory parameters • Increased − work_mem − maintenance_work_mem • Reduced − shared_buffers • wal_buffers 32MB • wal_level “archive”
  • 37. Deployment Planning © 2014 EnterpriseDB Corporation. All rights reserved. 37
  • 38. Backup and Recovery Strategies • Why do you need backup and recovery? Backup and Recovery Strategies protect you in case of: − Catastrophic Device Failure − Site Failure − Maintenance − Operator Error − Compliance − Data Corruption • Multiple components: − Logical backup provides granularity in objects (tables, table spaces, databases) − Physical backups provide granularity in time for PITR − Cold/off-line backups − Hot/on-line backup, with WAL archiving © 2014 EnterpriseDB Corporation. All rights reserved. 38
  • 39. Backup and Standby Snapshot Backup Approach © 2014 EnterpriseDB Corporation. All rights reserved. 39 Standby Approach hot 47% None 18% cold 12% warm 23% Physical Only 36% Logical Only 29% FS 7% Physical and Logical 14% None 14% 43% of customers could not execute PITR (prior to AHC) – some had NO backup in place 30% of customers would have been slow or unable to recover from failure
  • 40. Backup and Recovery Best Practices • Backup Strategy Framework − Logical backup after structural changes or major updates of reference/meta data − Physical backup (daily…) − WAL file archiving − Combine Backup/Recovery and Streaming Replication − Uses replica to offload hot backup and logical backup • Consider − Allowable PITR timeframe − Data retention policy − Test, test, test − Periodic backup validation • Advanced solutions, such as RHCS, Veritas Clustering , EFM and EDB BART augment the basic capabilities © 2014 EnterpriseDB Corporation. All rights reserved. 40
  • 41. Customer Case Study Use Case: on-line advertising service with hosted chat Stage: post-production Primary Issue: • Outage due to replication failure - insufficient log info to determine true root cause Potential Pain Points • Concerns have reached limits of scale and meeting anticipated growth demands © 2014 EnterpriseDB Corporation. All rights reserved. 41 Recommendations • Backup and recovery strategies − Implement continuous archive recovery in addition to streaming replication − Revised backup strategy with PITR − Tune auto-vacuum settings and manually vacuum large tables • Indexes – create concurrent indexes, REINDEX to reduce bloat • Parameter tuning – various for kernel, memory settings and WALs
  • 42. File System and Storage Subsystem • Types of Storage Systems − Direct Attached Storage (DAS) − Storage Area Network (SAN) w. Fiber Channel − Storage Area Network (SAN) w. iSCSI − Network File System (NFS) • DAS: Fast and low latency • SAN: Fast, expensive (w. Fiber Channel), scalable, can include redundancy and smart file system operations • NFS: Not an optimal solution for PostgreSQL data files © 2014 EnterpriseDB Corporation. All rights reserved. 42
  • 43. Summary and Useful Resources © 2014 EnterpriseDB Corporation. All rights reserved. 43
  • 44. Summary • Postgres DBAs need to focus on − Config file settings, especially understanding memory configs − Storage subsystem configuration − OS Configuration − Bloat & vacuum − Backup - logical and physical − HA setup − Monitoring - see the Freight Train before it hits you! • Tools, tools, tools – Get the right tools • Most problems occur when moving to production − Get ready early − Get trained before MTP − New Postgres DBA -- consider RDBA to help you get started © 2014 EnterpriseDB Corporation. All rights reserved. 44
  • 45. What You Can Do • Training & Certification − Classroom Comprehensive Admin - Bangalore – Sept 15-19 − Comprehensive Admin Live Online – NA- with Bruce Momjian – PostgreSQL Guru and community leader – Oct 6-10 − Live Online EMEA – Adv. PostgreSQL Admin – with 9.4 Highlights – Oct 13-15 • Get the team (developer, DBA, Infrastructure) ready to thrive with Postgres • EDB Knowledge Base • Blogs − Robert Haas – EDB Chief Architect Database Server (http://rhaas.blogspot.com/) − Vibhor Kumar – EDB Database Consultant (http://vibhorkumar.wordpress.com/) • User groups and Meetups – almost all major cities − http://www.postgresql.org/community/user-groups/ − http://postgresql.meetup.com/ • PostgresOpen 2014 - Sept 17-19 Chicago • PostgreSQL Conference Europe 2014 - Oct 21-24 Madrid © 2014 EnterpriseDB Corporation. All rights reserved. 45
  • 46. Architectural Health Check • Review of database, OS, env. settings • Guidance on tuning, backup, high availability strategies Remote DBA Services • 24 x 7 monitoring • Supplemental staff • Architectural health check • Access to Postgres expertise © 2014 EnterpriseDB Corporation. All rights reserved. 46 Kick Start • Training • Flex consulting • Developer subscription Training and Certification • Flexible formats: on-demand, live virtual, on-site • Continuing education and Postgres certification How We Can Help Whitepapers and Recorded Webinars http://www.enterprisedb.com/resources-community
  • 47. Special Offers for Attendees For all attendees we are providing a special offer on related DBA services including training. Please complete an inquiry form on-line and mention this webinar, or speak to your account manager − EDB’s regional sales offices found on enterprisedb.com: − US +1 781-357-3390 or 1-877-377-4352 − EMEA +31 (0) 70 36 11 774 − JAPAN +81-50-5532-7038 − KOREA +82-2-6007-2500 − PAKISTAN +92-51-8358874 − INDIA +91-20-30589500/01 − Send email to [email protected] − http://www.enterprisedb.com/general-inquiry-form © 2014 EnterpriseDB Corporation. All rights reserved. 47
  • 48. Q&A © 2014 EnterpriseDB Corporation. All rights reserved. 48