// postgresql · sql behavior

shared_preload_libraries

Libraries loaded into the server at startup, such as pg_stat_statements or auto_explain.

デフォルト
'' (empty)
Range
Comma-separated library names
Restart needed
はい
Default checked on
PostgreSQL 18

何ができるか

Extensions that need shared memory or hooks at startup must be listed here before CREATE EXTENSION works fully.

デフォルト値

'' (empty). Empty (PostgreSQL 18). Managed services usually preload pg_stat_statements.

Check the current value

SHOW shared_preload_libraries;

SELECT setting, unit, boot_val, context, source, pending_restart
FROM pg_settings
WHERE name = 'shared_preload_libraries';

Change it

ALTER SYSTEM SET shared_preload_libraries = 'pg_stat_statements,auto_explain';
-- applies only after a server restart

Server restart required (pg_settings.context is postmaster). ALTER SYSTEM only stages the new value in postgresql.auto.conf.

When to change it

Add pg_stat_statements on every server you care about; it is the most useful single diagnostic.

What can go wrong

A misspelled or missing library prevents the server from starting.

Questions about shared_preload_libraries

What is the default value of shared_preload_libraries in PostgreSQL?

'' (empty). Empty (PostgreSQL 18). Managed services usually preload pg_stat_statements.

Does changing shared_preload_libraries require a restart?

Yes. Server restart required (pg_settings.context is postmaster). ALTER SYSTEM only stages the new value in postgresql.auto.conf.

When should I change shared_preload_libraries?

Add pg_stat_statements on every server you care about; it is the most useful single diagnostic.

Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.

// one client for every engine

Check shared_preload_libraries on your own server

SQLly runs the query above against PostgreSQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.