Skip to content

pg_part

Table partitioning utility for PostgreSQL

pg_part · Table partitioning utility for PostgreSQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
100079pg_partpg_part0.1.0OLAPGPL-2.0SQL
Relationships
Requiresplpgsql

Usage

Sources:

pg_part provides PL/pgSQL helpers in the fixed pgpart schema for legacy inheritance-based partitioning. It can add, merge, attach, detach, and list child tables.

CREATE EXTENSION pg_part;
SELECT pgpart.show_partition('public', 'orders');
SELECT pgpart.attach_partition('public', 'orders', 'orders_2025',
                               'order_date >= ''2025-01-01''');

The add and merge paths build dynamic DDL and use server-side COPY files to move rows. Identifiers, check expressions, and file paths are concatenated into SQL, so restrict execution to trusted administrators and never pass user-controlled text. This predates declarative partitioning; rehearse locking, constraints, indexes, privileges, failure rollback, disk capacity, and cleanup on a copy before touching important data, and prefer core declarative partitioning for new systems.

Table reader