postgresql_16:9.6.32 pg_stat_statements — track statistics of SQL planning and execution
PostgreSQL 16 > Appendixes > Additional Supplied Modules and Extensions > pg_stat_statements — track statistics of SQL planning and execution
The pg_stat_statements module provides a means for tracking planning and execution statistics of all SQL statements executed by a server.
The module must be loaded by adding pg_stat_statements to (see guc-shared-preload-libraries) in postgresql.conf, because it requires additional shared memory. This means that a server restart is needed to add or remove the module. In addition, query identifier calculation must be enabled in order for the module to be active, which is done automatically if (see guc-compute-query-id) is set to auto or on, or any third-party module that calculates query identifiers is loaded.
When pg_stat_statements is active, it tracks statistics across all databases of the server. To access and manipulate these statistics, the module provides views pg_stat_statements and pg_stat_statements_info, and the utility functions pg_stat_statements_reset and pg_stat_statements. These are not available globally but can be enabled for a specific database with CREATE EXTENSION pg_stat_statements.
Subsections
- postgresql_16:9.6.32.1 The
pg_stat_statementsView - postgresql_16:9.6.32.2 The
pg_stat_statements_infoView - postgresql_16:9.6.32.3 Functions
- postgresql_16:9.6.32.4 Configuration Parameters
- postgresql_16:9.6.32.5 Sample Output
- postgresql_16:9.6.32.6 Authors