pg_stat_statements is a PostgreSQL extension that tracks planning and execution statistics for SQL statements. It supports query and performance optimization by showing how statements behave over time. section 7.3
Use it alongside related performance extensions:
- Combine statement statistics with auto_explain, which logs execution plans for slow queries. section 7.3
- Compare observed query behavior with hypopg, which tests hypothetical indexing strategies without creating real indexes. section 7.3

