pathman_sharding
pathman_sharding · Improved sharding for pg_pathman.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100357 | pathman_sharding | pathman_sharding | 0.1 | OLAP | PostgreSQL | C |
PostgreSQL · 10
| Relationships | |
|---|---|
| Requires | pg_pathman plpgsql postgres_fdw |
Usage
Sources:
- Extension control file
- Common SQL objects
- Hash-sharding SQL
- Range-sharding SQL
- Required postgres_fdw patch
- Remote DDL and index-copy implementation
- ProcessUtility hook implementation
pathman_sharding 0.1 is a historical PostgreSQL 10-era companion to pg_pathman. It creates postgres_fdw partitions and mirrors their physical tables and parent indexes onto remote PostgreSQL servers; it does not work with stock postgres_fdw and is not a modern built-in partitioning solution.
Nonstandard Prerequisites
Install pg_pathman, postgres_fdw, and pathman_sharding, placing pathman_sharding in the same schema as pg_pathman. The repository’s patch must also be applied to PostgreSQL’s bundled postgres_fdw; it adds postgres_fdw_execute_custom_command(text,text), which the extension calls for remote DDL. A stock PostgreSQL installation does not provide that function.
Each operator needs a working user mapping for every foreign server. The patched function executes commands through the current PostgreSQL role’s mapping, so installation success alone does not prove that remote creation or deletion will work.
Set the partition_data argument to true only after validating data movement and capacity; false creates the partitions but leaves existing rows in the parent.
Main Objects
create_foreign_hash_partitionscreates hash partitions and distributes their names round-robin across foreign servers by default.add_foreign_range_partitionadds one foreign partition to a parent already configured for range partitioning.distribute_partitions_among_serversis the default assignment procedure and can be replaced through the hash-creation function’s procedure argument.pathman_foreign_partition_listjoins pg_pathman metadata to foreign-table and server metadata.
Remote DDL, Privilege, and Compatibility Boundaries
The ProcessUtility hook reacts to creation and deletion of pg_pathman foreign partitions. Creation sends remote table DDL and then attempts to copy every parent index; index-copy errors are caught and ignored. Deletion sends remote DROP TABLE ... CASCADE. Always compare local and remote tables and indexes after an operation, and coordinate backups and recovery for every shard.
The SQL grants public read access to pathman_foreign_partition_list, including foreign-server srvoptions. The postgres_fdw patch creates the raw command function without an explicit privilege restriction. Revoke EXECUTE from PUBLIC on postgres_fdw_execute_custom_command(text,text) and on the sharding helpers, then grant only to a tightly controlled administration role.
Upstream has no README, release history, upgrade scripts, or current compatibility matrix. The source uses PostgreSQL 10 utility-hook and relation APIs and the catalog only identifies PostgreSQL 10. Do not assume it builds on newer majors. Test patched-server builds, hook coexistence, role mappings, remote DDL failures, partial index creation, routing, data movement, and teardown in an isolated cluster before considering legacy maintenance use.