Unlock this content

Enter your email to unlock this content for free

By continuing, you agree to our Terms of Service and Privacy Notice, and to receive occasional marketing emails.

Why Schema Evolution is Hard

TL;DR

Schema evolution in ClickHouse is hard by design because ClickHouse writes data in immutable parts optimized for performance. Once you set your sorting key or partition key, you cannot change them. Many operations require full rewrites of data, making schema evolution an infrastructure problem that requires careful planning, backfilling, and coordination with live ingestion.

Once in production, you need to evolve schemas to support new use cases. Schema evolution in ClickHouse is an infrastructure and data engineering problem that requires careful planning.


Why Schema Evolution is Hard by Design

ClickHouse writes data in immutable parts optimized for performance. This immutability means that once data is written, changing its structure requires rewriting it.

Once you set your ORDER BY (sorting key) or PARTITION BY (partition key), you cannot change them. These are fundamental to how ClickHouse organizes data on disk. If you need to change the sorting key, you cannot use ALTER TABLE to modify it. You must create a new table with the new sorting key, backfill all historical data, update all dependent materialized views, and coordinate with live ingestion.

Cannot change sorting key with ALTER:

Tinybird is not affiliated with, associated with, or sponsored by ClickHouse, Inc. ClickHouse® is a registered trademark of ClickHouse, Inc.

Why Schema Evolution is Hard | ClickHouse for Developers