pgNow

Enabling pg_stat_statements on PostgreSQL

The instructions below are for PostgreSQL, if you need instructions for Azure Flexible Server or Amazon RDS and Aurora PostgreSQL they can be found here

Amazon RDS and Aurora PostgreSQL

Azure Flex server

Edit the postgresql.conf file: 

  1. Locate and open your postgresql.conf file. 
  2. Add pg_stat_statements to the shared_preload_libraries parameter:shared_preload_libraries = 'pg_stat_statements'

 

Restart PostgreSQL: 

  1. For the changes to take effect, restart your PostgreSQL server. 

 

Create the extension: 

  1. Connect to your database using psql and run:CREATE EXTENSION pg_stat_statements;

Verify the extension: 

  1. You can check if the extension is enabled by running:\dx 
     

Didn't find what you were looking for?