Kernel Version
Choosing a “kernel” in Pigsty means determining the PostgreSQL major version, mode/distribution, packages to install, and tuning templates to load.
The Pigsty v4.5 source currently supports PostgreSQL 14-18 and uses 18 by default. The following content shows how to make these choices through configuration files.
Major Version and Packages
pg_version: Specify the PostgreSQL major version (default 18). Pigsty will automatically map to the correct package name prefix based on the version.pg_packages: Define the core package set to install, supports using package aliases (defaultpgsql-main pgsql-common, includes kernel + patroni/pgbouncer/pgbackrest and other common tools).pg_extensions: List of additional extension packages to install, also supports aliases; defaults to empty meaning only core dependencies are installed.
Effect: Ansible will pull packages corresponding to
pg_version=18during installation, pre-install extensions to the system, and database initialization scripts can then directlyCREATE EXTENSION.
Extension support varies across versions in Pigsty’s offline repository: 14 has relatively fewer available extensions, while 17/18 have the broadest coverage. If an extension is not pre-packaged, it can be added via repo_extra_packages.
Kernel Mode (pg_mode)
pg_mode controls the kernel “flavor” to deploy. Default pgsql indicates standard PostgreSQL. Pigsty currently supports the following modes:
| Mode | Scenario |
|---|---|
pgsql |
Standard PostgreSQL, HA + replication |
citus |
Citus distributed cluster, requires additional pg_shard / pg_group |
gpsql |
Cloudberry / Greenplum / MatrixDB |
mssql |
Babelfish |
mysql |
OpenGauss/HaloDB compatible with MySQL protocol |
polar |
Alibaba PolarDB (based on pg polar distribution) |
ivory |
IvorySQL (Oracle-compatible syntax) |
pgtde |
Percona PostgreSQL with pg_tde under /usr/pgtde-$v |
oriole |
OrioleDB storage engine |
agens |
AgensGraph graph database kernel |
pgedge |
pgEdge distributed replication kernel |
pg_mode determines binary paths, Patroni integration, and some kernel-specific logic; it does not automatically add every required package, extension, and business database. Use the matching conf/*.yml template in real deployments, or explicitly configure pg_packages, pg_extensions, pg_libs, and pg_databases. Here is a minimal Citus example:
conf/ha/citus.ymlprovides the current complete example. The minimal configuration above explicitly installs Citus packages and creates the extension in thecitusdatabase.
Extensions and Pre-installed Objects
Besides system packages, you can control components automatically loaded after database startup through the following parameters:
pg_libs: List to write toshared_preload_libraries. For example:pg_libs: 'timescaledb, pg_stat_statements, auto_explain'.pg_default_extensions/pg_default_schemas: Control schemas and extensions pre-created intemplate1andpostgresby initialization scripts.pg_parameters: Rendered by Pigsty intopostgresql.auto.confduring configuration. Do not also manage the same settings manually withALTER SYSTEM.
Example: Enable TimescaleDB, pgvector and customize some system parameters.
Effect: During initialization, default extensions are created in
template1andpostgres; newly created databases based ontemplate1inherit those objects.pg_parametersis written directly topostgresql.auto.conf.
Tuning Template (pg_conf)
pg_conf points to Patroni templates in roles/pgsql/templates/*.yml. Pigsty includes four built-in general templates:
| Template | Applicable Scenario |
|---|---|
oltp.yml |
Default template, for 4–128 core TP workload |
olap.yml |
Optimized for analytical scenarios |
crit.yml |
Emphasizes sync commit/minimal latency, suitable for zero-loss scenarios like finance |
tiny.yml |
Lightweight machines / edge scenarios / resource-constrained environments |
You can directly replace the template or customize a YAML file in templates/, then specify it in cluster vars.
Effect: Copy
crit.ymlas Patroni configuration, overlaypg_parameterswritten topostgresql.auto.conf, making instances run immediately in synchronous commit mode.
Combined Instance: A Complete Example
- First primary + one replica, using
olap.ymltuning. - Install PG18 plus common RAG extensions; only libraries that actually require preloading belong in
pg_libs. - Patroni/pgbouncer/pgbackrest generated by Pigsty, no manual intervention needed.
Replace the above parameters according to business needs to complete all kernel-level customization.