Config
Some extensions require you to preload dynamic libraries or configure parameters before use. This section gives the configuration procedures.
Preload Extensions
After installation, you can enable most extensions with CREATE EXTENSION.
Some extensions use PostgreSQL’s Hook mechanism and require preloading.
Set shared_preload_libraries to specify the libraries to preload.
A database restart is required to apply the change.
Extensions Requiring Preload
Common extensions that require preloading:
| Extension | Description |
|---|---|
timescaledb | Time-series database extension, must be placed first |
citus | Distributed database extension, must be placed first |
pg_stat_statements | SQL statement statistics, enabled by default in Pigsty |
auto_explain | Automatically log slow query execution plans, enabled by default in Pigsty |
pg_cron | Scheduled task scheduling |
pg_net | Asynchronous HTTP requests |
pg_tle | Trusted language extensions |
pgaudit | Audit logging |
pg_stat_kcache | Kernel statistics |
pg_squeeze | Online table space reclamation |
pgml | PostgresML machine learning |
For the complete list, see the Extension Catalog (marked with LOAD).
Preload Order
Use the required loading order in shared_preload_libraries:
- Put
timescaledbandcitusfirst. - If you use both,
citusshould come beforetimescaledb. - Statistics extensions should come after
pg_stat_statementsto use the same query_id.
Configure During Cluster Initialization
For a new cluster, use pg_libs to specify the extensions to preload:
During cluster initialization, Pigsty writes the value of pg_libs to shared_preload_libraries.
Default Value
The default value of pg_libs is pg_stat_statements, auto_explain.
These two Contrib extensions provide basic observability:
pg_stat_statements: Track execution statistics of all SQL statementsauto_explain: Automatically log execution plans for slow queries
Modify Configuration on Existing Cluster
For initialized clusters, use patronictl to modify shared_preload_libraries:
You can also directly modify postgresql.conf or use ALTER SYSTEM:
After the change, restart the PostgreSQL service.
Extension Parameter Configuration
Many extensions have parameters that you can configure in the following locations:
During Cluster Initialization
Use pg_parameters to set extension parameters:
Runtime Modification
Use ALTER SYSTEM or patronictl:
Important Notes
Preload errors prevent startup: If an extension in
shared_preload_librariesdoes not exist or fails to load, PostgreSQL will not start. Install each extension correctly before you add it to the preload list.Modification requires restart: After you change
shared_preload_libraries, restart the PostgreSQL service to apply the change.Partial functionality available: Some extensions provide limited functionality without preloading. Full functionality requires preloading.
View current configuration: Run this command to show the current preload libraries:
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)