How can I resolve the "ERROR: <module/extension> must be loaded via shared_preload_libraries" error?
I have an Amazon Relational Database Service (Amazon RDS) for PostgreSQL DB instance. I received the error "ERROR:  <module/extension> must be loaded via shared_preload_libraries". How do I troubleshoot and resolve this error?
"I have an Amazon Relational Database Service (Amazon RDS) for PostgreSQL DB instance. I received the error "ERROR:  <module/extension> must be loaded via shared_preload_libraries". How do I troubleshoot and resolve this error?Short DescriptionWhen using Amazon RDS for PostgreSQL, you can preload shared libraries into the server in order to load additional functionality or to achieve performance benefits. However, you can receive the following error when trying to use the module/extension: "ERROR:  <module/extension> must be loaded via shared_preload_libraries"For example, when querying pg_stat_statements, you can receive the following error:postgres=> SELECT * FROM pg_stat_statements;ERROR:  relation "pg_stat_statements" does not existpostgres=> CREATE EXTENSION IF NOT EXISTS pg_stat_statements;CREATE EXTENSION postgres=> SELECT * FROM pg_stat_statements;ERROR:  pg_stat_statements must be loaded via shared_preload_librariesIn order to resolve this error and query pg_stat_statements, set the value of shared_preload_libraries to pg_stat_statements in a custom parameter group associated with your DB instance.You can use the following modules/extensions on RDS PostgreSQL by modifying the value of the parameter shared_preload_libraries in a custom parameter group:auto_explainorafcepgauditpglogicalpg_hint_planpg_prewarmpg_similaritypg_stat_statementspg_transportplprofilerNote: You can modify parameter values in a custom parameter group. You can't change the parameter values in a default DB parameter group. If you make changes to parameters in a custom parameter group, then your changes are applied to all DB instances associated with that parameter group.ResolutionCreate a custom parameter groupNote: If you already have a custom parameter group, skip to the next step.Login to the Amazon RDS console.In the navigation pane, choose Parameter groups.Choose Create parameter group.In the Parameter group family list, select a DB parameter group family.In the Group name box, enter the name of the new DB parameter group.In the Description box, enter a description for the new DB parameter group.Choose Create.Modify the parameter in custom parameter groupLogin to the Amazon RDS console.In the navigation pane, choose Parameter groups.In the list, choose the parameter group that you want to modify.For Parameter group actions, choose Edit.Change the values of the parameter shared_preload_libraries.Choose Save changes.Note: The shared_preload_libraries parameter is a static parameter. When you change a static parameter and save the DB parameter group, the parameter change takes effect after you manually reboot the DB instance.Associate the parameter group to your DB instanceNote: If your custom parameter group is already associated to your DB instance, skip to the next step.Modify your DB instance to associate the custom parameter group to your DB instance.Reboot the DB instanceWhen you change a static parameter and save the DB parameter group, the parameter change takes effect after you manually reboot the DB instance.When you change the DB parameter group associated with a DB instance, you must manually reboot the DB instance before the DB instance uses the new DB parameter group.Reboot your DB instance using the Amazon RDS console or by explicitly calling the RebootDBInstance API operation (without failover, if the DB instance is in a Multi-AZ deployment).Related InformationPostgreSQL documentation for pg_stat_statementsWorking with DB Parameter GroupsFollow"