When did that mutation finish?
system.mutations told you when a mutation started but not when it ended. I asked for finish_time; it shipped in 26.8 after a first attempt was reworked to avoid persistent state.
Source: github.com
system.mutations has create_time, parts_to_do, is_done and latest_fail_time, but not when a mutation ended, so “how long did last night’s mutations take?” had no answer in SQL. I asked for a finish_time DateTime column.
It was labelled easy task, and two PRs tried it. The first, #105255, closed unmerged after a contributor, ZelvaMan, asked the deciding question: must it survive a restart? Persisting means a file-format or Keeper change with upgrade and cleanup questions. The second, #113474 by nikitamikhaylov, reworked it to add no persistent state, merged 2026-08-20 and closed the issue; it shipped in 26.8. Semantics:
0means not finished, or completion time unknown (entries loaded at startup, parts removed byDROP PARTITION).- Non-replicated MergeTree stamps the time in memory when completion is observed.
- For
ReplicatedMergeTreethe value is per replica: the modification time of the replica’smutation_pointerznode. For a cluster-wide time usemax(finish_time)permutation_id.
The column is absent on 26.4, the binary I have here, and present on 26.8 (not run here, so treat the query as intended usage):
SELECT mutation_id, command,
dateDiff('second', create_time, finish_time) AS seconds
FROM system.mutations
WHERE is_done AND finish_time != toDateTime(0)
ORDER BY seconds DESC LIMIT 10;
The finish_time != 0 filter matters: after a restart old mutations honestly report unknown. See watch mutation progress.
Discussion
Comments live in GitHub Discussions. Sign in with GitHub to join in.