u/Holy_Ghost13

Best way to perform schema migration in Clickhouse?

I am using Clickhouse for storing analytics data. Right now an example is I have a table with AggregatingMergeTree as the engine. Now in the event where I need to add another column which must be part of the sorting keys used by the engine for aggregation, which is the best way to add that? From what I have read you can add a new sorting key when column is also new.
(1) Is there any consequence for this action as when it is done, shouldn't the entire table reordered?
(2) Will I require any downtime/issues while doing this?
(3) Any other factors which I should consider?
Please advise.

reddit.com
u/Holy_Ghost13 — 19 hours ago

I have MySQL and Clickhouse running for my system. Here MySQL is the source of truth and I store analytical data such as metrics (count, avg etc..) in Clickhouse. I have aggregated tables in Clickhouse with storing an ID and its count (just a simple example, its used for analytical purposes for a real-time dashboard which show different kinds of aggregation results based on user query). One of my requirement is get the IDs grouped by count.
MySQL holds a status corresponding to each ID I have like, disabled, deactivated, active etc ..
So I need to show only the grouped by result for ID which are only active. 
Should i maintain a state for IDs in Clickhouse too and join these (this is probably a bad idea)? or is there any better/recommended way?

reddit.com
u/Holy_Ghost13 — 1 month ago