case studies on postgresql
TRANSCRIPT
© 2014 EnterpriseDB Corporation. All rights reserved. 1
Technical Case Studies in PostgreSQL[ Monitoring Methods ]
Rohit Vyas | 11.04.15
Quality Management Group (PostgreSQL Installer and Tools)
© 2014 EnterpriseDB Corporation. All rights reserved. 2
• Technical cases in PostgreSQL
• Database Monitoring Methods
Agenda
© 2014 EnterpriseDB Corporation. All rights reserved. 3
− Bloats− Updates/Deletes cause bloats in a table in
PostgreSQL.
− Transaction Wraparound− No new XID’s if 4 billion mark reached.
− Streaming/WAL Replication Lag− Number of bytes lag from Master database may
be due to bulk load, network etc.,
− Handling WAL Archiving Files− Piling up .ready files due to failure of archiver
process
− Catalog Corruption− Database objects repository(pg_catalog schema)
corruption.
Technical Cases on Production Database
ERROR: database is not accepting commands to avoid
wraparound data loss in database "dvnspatial"
Hint: Stop the postmaster and use a standalone
backend to vacuum that database.
You might also need to commit or roll back old prepared
transactions.
Error executing update (updateorg.matter.security.User)
PANIC: could not write to file
“pg_xlog/xlogtemp.556” :No space left on
device
notice: pg_class row has invalid relnamespace "24580":
no matching entry in pg_namespace
row identity: oid="24581" relname="foo" relkind="r"
© 2014 EnterpriseDB Corporation. All rights reserved. 4
• Using pg_catalog Tables/Views/Functions
• Wrapping pg_catalog in Shell or any scripting language.
• Using open source tools − check_postgres.pl, pg_catcheck, pg_cluu, munin, Nagios etc
• Proprietary Tools − EnterpriseDB Postgres Enterprise Manager
Database Monitoring Methods
© 2014 EnterpriseDB Corporation. All rights reserved. 5
• Tables− pg_class
− pg_database
• Views− pg_stat_activity
− pg_stat_all_tables
− pg_stat_archiver
− pg_stat_replication
• Functions− pg_is_in_recovery()
− pg_last_xlog_replay_location()
− pg_last_xact_replay_timestamp()
− pg_xlog_location_diff()
Using pg_catalogs
© 2014 EnterpriseDB Corporation. All rights reserved. 6
Wrapping pg_catalogs in Shell or Other languages
Max Connections
Long Running queries
Idle Connections
Waiting Connections
© 2014 EnterpriseDB Corporation. All rights reserved. 7
• check_postgres.pl
• pg_catcheck [ catalog corruption ]
• pg_cluu
Using open source tools
© 2014 EnterpriseDB Corporation. All rights reserved. 8
Sample output of critical probes on Production Environment
© 2014 EnterpriseDB Corporation. All rights reserved. 9
pg_catcheck
© 2014 EnterpriseDB Corporation. All rights reserved. 10
Monitoring with Proprietary Tools
• Postgres Enterprise Manager [ EnterpriseDB] PostgreSQL
Instances of different versions
9.0.x
9.1.x9.4.x
9.3.x
9.2.x
PEM
Server
© 2014 EnterpriseDB Corporation. All rights reserved. 11
PEM Probes And Alerts
Table Bloat Total table bloat in server
Highest Table Bloat in server
Table Frozen XID Table FrozenXID
Database Frozen XID Database FrozenXID
Number of WAL Files Number of WAL Files
WAL Archive status Number of WAL archiving Pending
Streaming Replication Standby server lag behind the master By WAL
segment
Standby server lag behind the master by WAL
pages
Streaming Replication Lag Number of minutes lag in standby server from
master server
© 2014 EnterpriseDB Corporation. All rights reserved. 12
Dashboard's Charts
© 2014 EnterpriseDB Corporation. All rights reserved. 13
PEM Alerts
© 2014 EnterpriseDB Corporation. All rights reserved. 14
• Complete point and click management of all database objects
• 225+ pre-configured database alerts for immediate global at-a-glance monitoring complete with SMTP notifications, SNMP traps and richly configurable notification rules (New)
• Remote Monitoring (New)
• A Capacity Planning and Forecast Manager
• PostgreSQL Expert database configuration recommendations and deployment
• Log Management and a Log Analysis Expert (New)
• Team Management
• Custom probes for gathering metrics (New)
• SQL Profiler
• Index Advisor
• All optimized for working with multiple databases consistently across the enterprise.
Primary Product Features
© 2014 EnterpriseDB Corporation. All rights reserved. 15
• On Premise Server
• Public Cloud [AWS]
• Private Cloud [Open stack ]
Deployment
© 2014 EnterpriseDB Corporation. All rights reserved. 16
References
• http://www.enterprisedb.com/products-services-training/products/postgres-enterprise-manager
Postgres Enterprise Manager
© 2014 EnterpriseDB Corporation. All rights reserved. 17
Questions?
© 2014 EnterpriseDB Corporation. All rights reserved. 18