clickhouse-migration-deep-dive

Featured

Execute ClickHouse schema migrations — ALTER TABLE operations, data migration between engines, versioned migration runners, and zero-downtime schema changes. Use when modifying ClickHouse schemas, migrating data between tables, or implementing versioned migration workflows. Trigger: "clickhouse migration", "clickhouse ALTER TABLE", "clickhouse schema change", "migrate clickhouse", "clickhouse add column", "clickhouse schema migration".

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# ClickHouse Migration Deep Dive ## Overview Plan and execute ClickHouse schema migrations: column changes, engine migrations, ORDER BY modifications, and versioned migration runners. ## Prerequisites - ClickHouse admin access - Backup of production data (see `clickhouse-prod-checklist`) - Test environment for validation ## Instructions ### Step 1: Understanding ClickHouse DDL ClickHouse ALTER operations are **mutations** — they run asynchronously and rewrite data parts in the background. This is fundamentally different from PostgreSQL/MySQL where ALTER is often instant or blocking. ```sql -- Lightweight operations (instant, metadata only) ALTER TABLE events ADD COLUMN country LowCardinality(String) DEFAULT ''; ALTER TABLE events RENAME COLUMN old_name TO new_name; ALTER TABLE events COMMENT COLUMN user_id 'Unique user identifier'; -- Heavyweight operations (mutations — rewrite parts in background) ALTER TABLE events MODIFY COLUMN properties String CODEC(ZSTD(3)); ALTER TABLE events DROP COLUMN deprecated_field; ALTER TABLE events DELETE WHERE user_id = 0; ALTER TABLE events UPDATE email = '' WHERE created_at < '2024-01-01'; -- Check mutation progress SELECT database, table, mutation_id, command, is_done, parts_to_do, create_time FROM system.mutations WHERE NOT is_done ORDER BY create_time; ``` ### Step 2: Column Operations ```sql -- Add a column (instant — no data rewrite) ALTER TABLE analytics.events ADD COLUMN IF NOT EXISTS country LowCardinality(Str...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category