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.

Schema Change Costs

TL;DR

Schema changes in ClickHouse fall into three cost categories: metadata changes (fast, cheap), table mutations (moderate cost, background processing), and full rewrites (expensive, require infrastructure). Understanding these categories helps you plan schema evolution and estimate the impact on your system.

Metadata Changes

Metadata changes are the cheapest schema operations in ClickHouse. They only modify table metadata (the schema definition) without touching the actual data on disk. ClickHouse stores metadata separately from data, allowing these changes to execute in milliseconds with minimal resource usage.

Adding columns:

ALTER TABLE events ADD COLUMN tenant_id String DEFAULT '';

Existing rows use the default value (computed on read), and new inserts can provide values or use the default. No data is rewritten.

Renaming columns:

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

Schema Change Costs | ClickHouse for Developers