Enabling pg_stat_statements on Azure Flex server
Published 13 February 2025
To enable pg_stat_statements
on an Azure Database for PostgreSQL Flexible Server, follow these steps:
Azure Portal:
- Go to the Azure Database for PostgreSQL Flexible Server resource management page.
- Select the Server Parameters blade.
- Find the
pg_stat_statements.track
parameter and set its value toTOP
orALL
depending on your needs.
Azure CLI:
- Use the following command to set the parameter:
az postgres flexible-server parameter set \ --resource-group <your-resource-group> \ --server-name <your-server-name> \ --name pg_stat_statements.track \ --value TOP
- Use the following command to set the parameter:
Restart the Server:
- After setting the parameter, you may need to restart the server for the changes to take effect.
This will enable the pg_stat_statements
extension, allowing you to track execution statistics for all SQL statements executed by the server