pg_partman
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_partman | 5.5.0 | OLAP | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2510 | pg_partman | No | Yes | No | Yes | No | No | - |
| Related | plpgsql timescaledb pg_ttl_index citus pg_fkpart timeseries pg_cron |
|---|---|
| Depended By | partman_to_cstore timeseries |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 5.5.0 | 1817161514 | pg_partman | plpgsql |
| RPM | PGDG | 5.5.0 | 1817161514 | pg_partman_$v | - |
| DEB | PGDG | 5.5.0 | 1817161514 | postgresql-$v-partman | - |
Build
You can build the RPM / DEB packages for pg_partman using pig build:
Install
You can install pg_partman directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources:
- pg_partman 5.5.0 README
- pg_partman 5.5.0 changelog
- pg_partman usage guide
- pg_partman reference
- pg_partman 5.5.0 control file
pg_partman automates PostgreSQL declarative partition sets by time or integer ID. It creates future partitions, applies retention, moves existing data, and can run maintenance through either SQL scheduling or an optional background worker. PostgreSQL tables remain ordinary native partitioned tables.
Core Workflow
create_partition() is the current name for creating a managed set. The older create_parent() remains available for backward compatibility in the 5.x line. Template tables carry properties that PostgreSQL does not automatically propagate; changes made to a template after children exist apply only to future children unless old partitions are adjusted separately.
Retention and Data Movement
Retention is destructive when child tables are configured to be dropped. If another table references the partition set with a foreign key, set detach_before_drop only after ensuring referencing rows no longer block detach or drop. When using retention_schema, version 5.5 requires that schema and each moved child table to have the same owner.
Background Worker
Add the worker library before server start:
Changing shared_preload_libraries requires a restart; the other worker settings can be reloaded. The worker role needs full access to the pg_partman schema and every managed partition set. Use a dedicated non-superuser role and grant it membership in the roles that own those tables:
The 5.5 default for pg_partman_bgw.role is partman_maintainer. An upgrade can therefore stop a previously implicit worker configuration from succeeding until that role exists and has the required privileges.
Version 5.5 Upgrade
Version 5.5 fixes several SQL-injection and privilege-escalation paths, adds maintenance_role columns for RLS policies on configuration rows, and lets maintenance continue with other partition sets after one set fails. A failed set gets a warning and a null last-run marker, so monitoring must alert on both PostgreSQL logs and configuration status.
The release also adds detach_before_drop, inherits per-column statistics targets, and changes the retention-schema ownership rule. Review PUBLIC grants after extension updates because some update scripts recreate extension functions or procedures.
Operational Boundaries
- PostgreSQL 14 or newer is required; version 5 uses only native declarative partitioning.
pg_jobmonis optional. Installing it adds job monitoring but also another privilege boundary.- pg_partman can be installed and run without superuser privileges when the owner, schema, table, procedure, function, temporary-table, and optional RLS grants are configured as documented.
- Only one scheduler should own routine maintenance. Do not run the background worker and an external scheduler concurrently without deliberate coordination.
- A large maintenance run can hold many locks and move substantial data. Test retention and migration on representative data, monitor the default partition, and keep backups independent of partition retention.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)