Glossary / pg_stat_statements

pg_stat_statements

Practical PostgreSQL glossary entry with a clear definition, example, and benchmarking context.

What Is pg_stat_statements?

This extension tracks execution statistics of all SQL queries in a PostgreSQL instance. It helps identify slow, frequent, or inefficient queries. Ideal for performance tuning and observability.

Why It Matters for PostgreSQL Performance

In PostgreSQL performance work, pg_stat_statements affects throughput, latency, or operational reliability depending on workload and configuration.

Practical Benchmarking Context

When benchmarking with pgbench, track how pg_stat_statements changes behavior across scale factor, client concurrency, and storage conditions.

Use this term together with workload shape, concurrency level, and scale factor when interpreting pgbench outputs. Isolated values can be misleading without full run context.

Example

Install: CREATE EXTENSION pg_stat_statements;

Related Resources