pg_stat_statements icon

pg_stat_statements

www.postgresql.org/docs/current/pgstatstatements.html

pg_stat_statements is a PostgreSQL core extension that tracks execution statistics for all SQL statements, providing essential performance monitoring without third-party tools.

Available in all PostgreSQL installations (requires enabling in postgresql.conf). The extension captures query patterns (normalized with parameter placeholders), execution counts, total/mean/min/max execution times, rows affected, and block I/O statistics. Essential for identifying slow queries, frequently executed queries, and performance regressions. Statistics persist across server restarts when configured. Works with pg_stat_statements_reset() for baseline management. Commonly combined with visualization tools like pgBadger, pgHero, or Percona PMM for dashboards. The extension has minimal performance overhead (typically <5%) making it suitable for production use.

Tags

Popular tags