
Unlock this content
Enter your email to unlock this content for free
Why Schema Evolution is Hard
TL;DR
Want to change your sorting key? That's a full table rewrite. Change a data type? Another rewrite. ClickHouse makes some schema changes easy, but the expensive ones can take days and require an expert team.
The Two Types of Schema Changes
Some changes are instant. Others will make you wait.
Instant (metadata-only):
- Adding a column - ClickHouse just updates metadata, existing rows get the default value
- Renaming a column - Fast, but breaks every query, dashboard, and app that references it
- Changing default values - Just metadata
- Changing codecs - Old data keeps old codec, new data uses new one
Expensive (full rewrites):
- Changing data types - Even "compatible" changes like Int32 to Int64 rewrite the entire column