Session

Point-in-time query tuning and observability with pg_stat_statements

Do you know which queries are acting abnormally today vs. yesterday? Which queries are fast but running 100,000 times per hour? Are there certain times per day that performance lags unexpectedly?

The pg_stat_statements extension is our most valuable tool for understanding the current state of query workloads within your PostgreSQL cluster. Unfortunately, all of the tracked metrics are cumulative until they are reset (either manually or with a restart), making it difficult to use for point-in-time tuning and observability.

In this talk, I'll review the metrics that pg_stat_statements provides and then demonstrate how to save the data to a table periodically for better visibility into your queries' performance and resource usage over time, including sample Grafana dashboards. We'll conclude the talk by discussing the additional benefits of storing this data in a TimescaleDB hyptertable, which provides native compression (store more data longer) and automatic data retention policies.

Ryan Booz

Developer Advocate at Redgate

State College, Pennsylvania, United States

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top