Point-in-time query tuning and observability with pg_stat_statements
summary
pg_stat_statements is cumulative by default (resets on restart or manual reset) and exposes 31 columns of stats; the method shown snapshots that view periodically into tables, computes per-statement deltas, and visualizes calls/min and exec-time in Grafana. Implementation uses pg_stat_statements output, scheduling via pg_cron or a TimescaleDB background job, storing rows in a partitioned/hypertable (default retention/compression reduces storage). Default statement buffer is ~5,000 entries; the demo pipeline works and reveals spikes and inefficient queries.
AI-written summary · about
chapters (5)
- 0:00Introduction
- 1:21pg_stat_statements primer
- 10:47How to track historical data
- 14:42Demo of pg_stat_statements
- 22:57pg_stat_monitor & pganalyze
related talks
51mPostgreSQL Query Performance Insights
50mPostgreSQL Query Performance Insights
57mQuery Logging and Workload Analysis
39mDeep dive into PostgreSQL internal statistics
49mProfessional PostgreSQL monitoring made easy
47mIdentifying Slow Queries and Fixing Them!
50mHow To Improve PostgreSQL Monitoring and Observability With PMM - Part 2
42mProfessional PostgreSQL monitoring made easy
