I am working on AWS RDS Postgres v9.6, and also v14. I noticed that in our shared_preload_libraries parameter, we have pg_stat_statement included. I don't understand why that needs to be there.

In the Postgres docs, it says this:

The module must be loaded by adding pg_stat_statements to shared_preload_libraries in postgresql.conf, because it requires additional shared memory. This means that a server restart is needed to add or remove the module.

However, several other extensions are already built in - for example we use dblink and hstore. These do not need to be in shared_preload_libraries. Why does pg_stat_statement behave differently?

I think shedding light on this would help me (and hopefully others) better understand how built in libraries work, especially as regards the shared_preload_libraries parameter. The docs don't seem to say enough on this topic, or else I don't know where to find it.

  • 3
    The reason is in the quote "because it requires additional shared memory."
    – user1822
    Mar 10, 2022 at 21:25

1 Answer 1


pg_stat_statements stores its data in a shared memory segment, and PostgreSQL only allows you to create shared memory segments when the server is started. So the extension has to be loaded at the time the server is started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.