Search code examples
sqlolapclickhousealter

ClickHouse limitations in column manipulation


I found in CH documentation that column manipulations have some limitations.

For tables that don’t store data themselves (such as Merge and Distributed), ALTER just changes the table structure, and does not change the structure of subordinate tables. For example, when running ALTER for a Distributed table, you will also need to run ALTER for the tables on all remote servers.

And here I have questions.. do you have some solutions to run it automatically? I have 4 servers created on containers and I don't want to login in each one and execute it manually commands like ALTER ... itd.


Solution

  • run ALTER TABLE db.table ADD COLUMN ... ON CLUSTER 'cluster-name'

    first part for underlying Engine=ReplicatedMergeTree(...) table, and in second part for Engine=Distributed(...) table