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 Evolution Primitives

TL;DR

ClickHouse provides ALTER commands for schema evolution including column operations (add, rename, drop), data type changes, codec modifications, TTL and engine settings, indexes, projections, and table operations. Most column operations are fast metadata changes, while some data type changes require full rewrites.

Column Operations

Column operations are among the most common schema changes in ClickHouse. Most are simple metadata changes that don't require rewriting data, making them safe and fast to execute in production.

Adding, renaming, and dropping columns:

-- Add column (fast metadata change) ALTER TABLE events ADD COLUMN tenant_id String DEFAULT ''; -- Rename column (fast metadata change, update dependencies) ALTER TABLE events RENAME COLUMN old_column_name TO new_column_name;

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

Schema Evolution Primitives | ClickHouse for Developers