Enabling pg_stat_statements on Amazon RDS and Aurora PostgreSQL
Published 13 February 2025
To enable pg_stat_statements
on Amazon RDS for PostgreSQL, follow these steps:
Modify the Parameter Group:
- Go to the Amazon RDS console.
- Select Parameter groups from the navigation pane.
- Choose the parameter group associated with your RDS instance or create a new one.
- Set the
shared_preload_libraries
parameter to includepg_stat_statements
.
Apply the Parameter Group:
- If you created a new parameter group, associate it with your RDS instance.
- Go to Databases in the RDS console.
- Select your RDS instance, choose Modify, and change the parameter group to the one you just modified.
- Save the changes and reboot the RDS instance for the new parameter group to take effect.
Create the Extension:
- Connect to your PostgreSQL database using a client like
psql
. - Run the following SQL command to create the extension:
CREATE EXTENSION pg_stat_statements;
- Connect to your PostgreSQL database using a client like
This will enable the pg_stat_statements
extension, allowing you to track execution statistics for SQL statements executed by the server