leo.blog();

2026-10-14

ClickHouse storage policy migration

Changed five cold MergeTree tables to the fast_and_s3 storage policy. ClickHouse rejected a direct switch from default because the target policy didn't retain the old volume name and disk together.

On ClickHouse 26.10.1, an intermediate policy named __default worked:

ALTER TABLE db.table MODIFY SETTING storage_policy = '__default';
ALTER TABLE db.table MODIFY SETTING storage_policy = 'fast_and_s3';

The public disk setting can select a disk instead of a storage policy; disk = 'default' is internally translated to a generated __default policy. The __ prefix also causes ClickHouse to skip the policy volume-compatibility check. The disk setting is documented, but using this internal prefix as a migration bridge is not a documented or stable API. Check the source for the ClickHouse version in use before relying on it.

References: MergeTree storage policies, disk-to-policy translation, and policy compatibility check.

Changing a table's policy doesn't move its existing parts. Moving parts to another volume still requires TTL or an explicit ALTER TABLE ... MOVE PART/PARTITION.

Leave a Comment