This skill analyzes ClickHouse system.part_log to diagnose issues from high part churn, mutations, and slow merges, guiding targeted remediation.
npx playbooks add skill altinity/skills --skill altinity-expert-clickhouse-part-log
Answers "what is happening to parts, how fast, and is anything failing?" from system.part_log, read as rate (events per minute), volume (rows and bytes) and errors.
Run altinity-expert-clickhouse-connection first if the connection mode, cluster and time window are not yet established.
checks.sql — 11 checks: part_log coverage sanity, part activity timeline by minute, NewPart rate per table, merge balance of new parts versus merges, merge duration distribution, MutatePart rate, outstanding mutation backlog, DownloadPart spikes, RemovePart spikes, MovePart spikes, and part_log rows with a non-zero error. Ten of the eleven need system.part_log; only part-log-07 reads system.mutations instead. If system.part_log does not exist, skip every other check and report that part_log is not enabled, since no part-lifecycle conclusion can be drawn without it.reference.md — background (event types, part lifecycle, settings); read only when you need to explain a recommendation.; and start with a -- @check <id> <title> header; keep the id with its result.-- @requires: skip the statement when the named table is missing, when keeper is required and the server has no Keeper/ZooKeeper, or when the version condition is not met. List skipped ids with the reason.{cluster} as written when a cluster macro exists; otherwise apply the connection skill's rewrite rule. Any other {placeholder} is a template variable: substitute a real value first or skip the statement.UNKNOWN_IDENTIFIER, run DESCRIBE TABLE system.<table> and drop the missing column.severity column is the verdict for that row. Copy it; do not re-grade.severity. Grade findings yourself with the rules below and say which rule you applied.error is a failed merge, mutation or fetch. Report the exception text and count, and treat a repeating error on one table as Major or worse.Full event breakdown for one table named by an earlier check:
SELECT event_type, count() AS events, sum(rows) AS rows_sum, formatReadableSize(sum(size_in_bytes)) AS bytes_sum, round(avg(duration_ms)) AS avg_ms, countIf(error != 0) AS errors FROM system.part_log WHERE event_time > now() - INTERVAL 24 HOUR AND database = '{database}' AND table = '{table}' GROUP BY event_type ORDER BY events DESC;
Insert batch size distribution for one table, to confirm micro-batching:
SELECT count() AS new_parts, quantiles(0.5, 0.9, 0.99)(rows) AS rows_p50_p90_p99, quantiles(0.5, 0.9, 0.99)(size_in_bytes) AS bytes_p50_p90_p99 FROM system.part_log WHERE event_time > now() - INTERVAL 1 HOUR AND event_type = 'NewPart' AND database = '{database}' AND table = '{table}';
check, severity, object, evidence, recommendation; one row per finding, Critical first. Evidence quotes the numbers from the result rows.altinity-expert-clickhouse-ingestionaltinity-expert-clickhouse-mergesaltinity-expert-clickhouse-mutationsaltinity-expert-clickhouse-replicationaltinity-expert-clickhouse-storagealtinity-expert-clickhouse-schemaaltinity-expert-clickhouse-logsWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.