All Products
Search
Document Center

PolarDB:COALESCE PARTITION

Last Updated:Jan 11, 2024

This topic describes how to reduce the number of hash and key partitions and all their subpartitions, and move their data to other partitions and subpartitions.

Syntax

The ALTER TABLE…COALESCE PARTITION statement is used to reduce the number of hash and key partitions and all their subpartitions, and move their data to other partitions and subpartitions.
ALTER TABLE table_name COALESCE PARTITION num;

Parameters

ParameterDescription
table_nameThe name (optionally schema-qualified) of the partitioned table.
numThe number of partitions to be reduced. It must be less than the total number of partitions in the table.

Examples

Reduce two partitions in the sales_hash_hash partitioned table:
ALTER TABLE sales_hash_hash COALESCE PARTITION 2;
Reduce two partitions in the sales_key_key partitioned table:
ALTER TABLE sales_key_key COALESCE PARTITION 2;