3.1. Functions

shardman.broadcast_all_sql(statement text)

Executes statement on every replication group.

shardman.broadcast_sql(statement text)

Executes statement on every replication group but the current one.

shardman.attach_subpart(relid regclass, snum int, partition_bound text[])

Attaches previously detached subpartition number snum to locally-partitioned table relid as a partition for specified values. All subpartition tables and foreign tables should already exist. The partition_bound is a pair of lower and upper bounds for the partition. If lower and upper bounds are both NULL, a subpartition is attached as the default one.

The operation is performed cluster-wide.

Example:

select shardman.attach_subpart('pgbench_history'::regclass, 1,$${'2021-01-01 00:00', '2022-01-01 00:00'}$$);

shardman.create_subpart(relid regclass, snum int, partition_bound text[])

Creates subpartition number snum for locally-partitioned table relid as a partition for specified values. The partition_bound is a pair of lower and upper bounds for the partition. If lower and upper bounds are both NULL, a subpartition is created as the default one. If subpartition number is not specified, it will be selected as the next available partition number.

The operation is performed cluster-wide.

Examples:

select shardman.create_subpart('pgbench_history'::regclass, 1, $${'2021-01-01 00:00', '2022-01-01 00:00'}$$);
select shardman.create_subpart('pgbench_history'::regclass, partition_bound:=$${'2022-01-01 00:00', '2023-01-01 00:00'}$$);

shardman.detach_subpart(relid regclass, snum int)

Detaches subpartition number snum from locally-partitioned table relid. Partition number can be determined from the shardman.subparts view.

The operation is performed cluster-wide.

Example:

select shardman.detach_subpart('pgbench_history'::regclass, 1);

shardman.drop_subpart(relid regclass, snum int)

Drops subpartition number snum from locally-partitioned table relid. Partition number can be determined from the shardman.subparts view.

The operation is performed cluster-wide.

Example:

select shardman.drop_subpart('pgbench_history'::regclass, 1);