altinity-expert-clickhouse/skills/altinity-expert-clickhouse-mutations/SKILL.md
Track and diagnose ClickHouse ALTER UPDATE, ALTER DELETE, and other mutation operations. Use for stuck mutations and mutation performance issues.
npx skillsauth add altinity/skills altinity-expert-clickhouse-mutationsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Track and diagnose ALTER UPDATE, ALTER DELETE, and other mutation operations.
Run all queries from checks.sql in this skill's directory and analyze the results.
Check for competing operations using these ad-hoc queries:
-- Active merges on same table
select
database,
table,
is_mutation,
elapsed,
progress,
num_parts
from system.merges
where database = '{database}' and table = '{table}'
-- Replication queue for same table
select
type,
create_time,
is_currently_executing,
num_tries,
last_exception
from system.replication_queue
where database = '{database}' and table = '{table}'
order by create_time
limit 20
-- Part mutations status
select
name,
active,
mutation_version,
modification_time
from system.parts
where database = '{database}' and table = '{table}'
order by mutation_version desc
limit 30
To kill a stuck mutation:
-- Find mutation_id first
select mutation_id, command from system.mutations
where database = '{database}' and table = '{table}' and not is_done;
-- Then kill it
-- KILL MUTATION WHERE database = '{database}' AND table = '{table}' AND mutation_id = '{mutation_id}';
Warning: Killed mutations leave table in partially-mutated state.
| Anti-Pattern | Problem | Solution | |-------------|---------|----------| | Frequent small UPDATEs | Creates many mutations | Batch updates together | | DELETE without WHERE | Full table rewrite | Use TTL instead | | UPDATE on high-cardinality column | Slow, lots of IO | Restructure data model | | Many concurrent mutations | Queue builds up | Serialize mutations |
Set alerts for:
latest_fail_reason not empty| Finding | Load Module | Reason |
|---------|-------------|--------|
| Mutation blocked by merge | altinity-expert-clickhouse-merges | Merge backlog |
| Mutation OOM | altinity-expert-clickhouse-memory | Memory limits |
| Mutation slow due to disk | altinity-expert-clickhouse-storage | IO bottleneck |
| Replicated mutation stuck | altinity-expert-clickhouse-replication | Replication issues |
| Setting | Notes |
|---------|-------|
| mutations_sync | 0=async, 1=wait current replica, 2=wait all |
| max_mutations_in_flight | Max concurrent mutations |
| number_of_mutations_to_delay | Delay INSERTs threshold |
| number_of_mutations_to_throw | Throw error threshold |
tools
Read-only ClickHouse security audit expert for live or exported systems. Use when assessing ClickHouse security posture, reviewing users, roles, grants, settings profiles, row policies, table functions, external sources, table engines, executable UDFs, audit logs, named collections, password hash hygiene, SQL SECURITY DEFINER, impersonation, TLS/network exposure, Keeper/interserver security, encryption at rest, backups, the HTTP interface surface, cluster security, or version-specific ClickHouse security behavior. Diagnoses from SQL/system tables, supplied configuration files, query logs, access metadata, and ClickHouse/Altinity documentation.
tools
Diagnose and resolve ClickHouse grant and authentication errors, especially after upgrades. Use when queries fail with ACCESS_DENIED/NOT_ENOUGH_PRIVILEGES, AUTHENTICATION_FAILED/WRONG_PASSWORD/REQUIRED_PASSWORD, or ON CLUSTER privilege errors; when system.* or INFORMATION_SCHEMA access is denied; or when grant behavior changes after version upgrades.
tools
Profile a ClickHouse cluster via MCP and emit a per-cluster "analyst" Skill the user can save in claude.ai. Activate when the user asks to "profile this ClickHouse", "generate an analyst skill", "build a schema guide", "map the data in this cluster", or regenerate an existing cluster-analyst Skill after schema changes. Works against any ClickHouse with read-only SELECT/SHOW/DESCRIBE access via an `execute_query` MCP tool (e.g. the Altinity MCP server). Outputs a 5-file markdown bundle plus a README.
tools
Diagnose ClickHouse disk usage, compression efficiency, part sizes, and storage bottlenecks. Use for disk space issues and slow IO.