shared_preload_libraries
Fact — official short description: “Lists shared libraries to preload into server.”
Identity
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG9.0 (research boundary) |
| Present in | PG9.0–19 Beta 3 |
| Removed in | No |
| Introduction commit | Not asserted: predates the PG9.0 research boundary |
| Commit date | — |
| Discussion | — |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG9.0–19 Beta 3 | "" |
— | empty string |
How it works
shared_preload_libraries lists shared libraries to preload into server. Libraries load once in the postmaster before shared memory is finalized, enabling hooks and shared state unavailable to later LOAD; one missing library prevents server startup.
shared_preload_libraries is a POSTMASTER-context setting: PostgreSQL reads it during server startup, and a configuration reload or session SET cannot activate a new value.
Library discovery and preloading interact with installed binary versions, extension control files, server or backend startup, and the module’s own GUCs.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| OLTP | Do not tune shared_preload_libraries generically. Load or expose only modules required by a reviewed feature, verify binary compatibility, and rehearse failure recovery before rollout. |
| OLAP | Use shared_preload_libraries for a measured extension or JIT requirement, accounting for backend startup, resident memory, and behavior under connection pooling. |
| Small nodes | Keep shared_preload_libraries minimal. A missing or incompatible module can reject connections or prevent startup, and every preloaded library consumes scarce address space or memory. |
Pigsty
Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.
| Template | Effective value | Versus upstream boot | Source expression |
|---|---|---|---|
| OLTP | pg_stat_statements, auto_explain |
different | '{{ pg_libs | default("pg_stat_statements, auto_explain") }}' |
| OLAP | pg_stat_statements, auto_explain |
different | '{{ pg_libs | default("pg_stat_statements, auto_explain") }}' |
| CRIT | pg_stat_statements, auto_explain |
different | '{{ pg_libs | default("$libdir/passwordcheck, pg_stat_statements, auto_explain") }}' |
| TINY | pg_stat_statements, auto_explain |
different | '{{ pg_libs | default("pg_stat_statements, auto_explain") }}' |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 = pg_stat_statements, auto_explain (dcs); OLAP: PG9.0–19 Beta 3 = pg_stat_statements, auto_explain (dcs); CRIT: PG9.0–19 Beta 3 = pg_stat_statements, auto_explain (dcs); TINY: PG9.0–19 Beta 3 = pg_stat_statements, auto_explain (dcs). Advice, pending human review — Editorial inference: pg_stat_statements and auto_explain provide fleet-wide query statistics and targeted slow-plan evidence, accepting restart-time loading and shared overhead.
Common pitfalls
- Expecting a reload or SET to activate shared_preload_libraries, although it requires a controlled server restart.
- Naming a missing or ABI-incompatible module and causing connection failure or a server that cannot start.
- Treating a search or preload path as harmless even though it defines which native code the server trusts.
- Changing shared_preload_libraries globally without a rollback plan and a client or operational compatibility test.
Related parameters
session_preload_libraries · local_preload_libraries · dynamic_library_path · jit_provider · extension_control_path
References
- PostgreSQL 19 Beta 3 — shared_preload_libraries
- PostgreSQL 19 release notes
- Machine-readable GUC export