liveBook · Manning

Pg_stat_statements

As explained in Just Use Postgres!

pg_stat_statements is a PostgreSQL extension that records planning and execution statistics for SQL statements.

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

How Just Use Postgres! covers it

How deep it goes
Defines the extension’s purpose but does not detail installation, configuration, collected fields, or statistics queries.
What you can do after
Evaluate SQL performance using recorded planning and execution statistics.
How it connects
Connects query statistics with execution-plan logging through auto_explain and hypothetical-index testing through hypopg.

Also explained in

Compare how 2 books explain pg_stat_statements →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Just Use Postgres!. The section links point to the parts of the book it draws on.