跳到主要内容
跳到主要内容

system.mutations

该表包含有关 mutations 的信息,这些 mutations 适用于 MergeTree 表及其进展。每个 mutation 命令由单个行表示。

Columns:

  • database (String) — 应用 mutation 的数据库名称。

  • table (String) — 应用 mutation 的表名称。

  • mutation_id (String) — mutation 的 ID。对于副本表,这些 ID 对应于 ClickHouse Keeper 中 <table_path_in_clickhouse_keeper>/mutations/ 目录中的 znode 名称。对于非副本表,这些 ID 对应于表的数据目录中的文件名。

  • command (String) — mutation 命令字符串(查询中 ALTER TABLE [db.]table 之后的部分)。

  • create_time (DateTime) — 提交执行 mutation 命令的日期和时间。

  • block_numbers.partition_id (Array(String)) — 对于副本表的 mutations,数组包含分区的 ID(每个分区一个记录)。对于非副本表的 mutations,数组为空。

  • block_numbers.number (Array(Int64)) — 对于副本表的 mutations,数组包含每个分区的记录,带有 mutation 获取的块号。只有包含小于该块号的块的部分将在分区中被变更。

    在非副本表中,所有分区的块号形成一个单一的序列。这意味着对于非副本表的 mutations,此列将包含一个记录,带有通过 mutation 获取的一个单一块号。

  • parts_to_do_names (Array(String)) — 需要变更的数据部分名称的数组,以便 mutation 完成。

  • parts_to_do (Int64) — 需要变更的数据部分数量,以便 mutation 完成。

  • is_killed (UInt8) — 指示 mutation 是否已被终止。 仅在 ClickHouse Cloud 中可用。

备注

is_killed=1 并不一定意味着 mutation 已完全完成。可能存在一个 mutation 的状态为 is_killed=1is_done=0,持续一段时间。这可能发生在另一个长时间运行的 mutation 阻塞了被终止的 mutation。这是一种正常情况。

  • is_done (UInt8) — 指示 mutation 是否完成的标志。可能的值:
    • 1 表示 mutation 已完成,
    • 0 表示 mutation 仍在进行中。
备注

即使 parts_to_do = 0,也可能由于长时间运行的 INSERT 查询而导致副本表的 mutation 尚未完成,该查询将创建一个新的数据部分需要被变更。

如果在变更某些数据部分时出现问题,以下列提供额外信息:

  • latest_failed_part (String) — 最新未能变更的部分的名称。

  • latest_fail_time (DateTime) — 最近一次部分变更失败的日期和时间。

  • latest_fail_reason (String) — 导致最近一次部分变更失败的异常消息。

Monitoring Mutations

要跟踪 system.mutations 表的进展,请使用如下查询 — 这需要对 system.* 表的读取权限:

提示

table='tmp' 中的 tmp 替换为您所检查变更的表的名称。

另请参阅