Begin by installing the pg_stat_statements module. Follow these steps:
- Modify the shared_preload_libraries line in postgresql.conf to include the module:
shared_preload_libraries = 'pg_stat_statements'
- If you are using PostgreSQL 9.1 or older, add this line to postgresql.conf:
custom_variable_classes = 'pg_stat_statements'
- Restart PostgreSQL with a command similar to this:
pg_ctl -D /db/pgdata restart
- Log in to PostgreSQL as a superuser into any database that should have access to pg_stat_statements and execute the following SQL statement:
CREATE EXTENSION pg_stat_statements;
Perform the following steps to prepare pg_stat_statements for generalized use:
- Execute this SQL statement as a database superuser to ...