系统表 system.cnch_parts 包含存储的所有数据 part 的信息,涵盖 part 的存储、状态、事务及关联表等关键属性,可用于监控 part 生命周期、排查数据存储问题。
字段名称 | 数据类型 | 字段含义说明 |
|---|---|---|
database | String | part 所属的数据库名称。 |
table | String | part 所属的表名称。 |
table_uuid | UUID | part 所属表的唯一 UUID 标识。 |
partition | String | part 所在的分区名称。 |
name | String | part 的名称。 |
chain_depth | UInt64 | 相较于 mutation 基线的版本链长度。 |
bytes_on_disk | UInt64 | part 在磁盘上占用的空间大小,单位为字节。 |
rows_count | UInt64 | part 包含的总行数。 |
delete_rows | UInt64 | part 中被标记删除的行数。 |
columns | String | part 包含的列信息。 |
marks_count | UInt64 | part 的标记(mark)数量。 |
index_granularity | Array(UInt64) | part 的索引粒度数组。 |
commit_time | DateTime | part 提交到 ByteKV(元数据存储)的时间。 |
kv_commit_time | DateTime | part 使用的表结构(schema)版本对应的提交时间。 |
columns_commit_time | DateTime | 不修改表结构的 mutation 任务(如数据更新)的提交时间。 |
mutation_commit_time | DateTime | 涉及表结构修改的 mutation 任务的提交时间。 |
previous_version | UInt64 | 执行 mutation 后,新 part 指向原 part 的 commit_time,用于版本追溯。 |
partition_id | String | part 所在分区的唯一标识 ID。 |
bucket_number | UInt64 | part 的桶哈希结果。 |
total_bucket_cnt | UInt64 | 总桶数量。 |
table_definition_hash | UInt64 | 表定义的哈希值。 |
outdated | UInt8 | part 是否过期:
|
visible | UInt8 | part 是否对查询可见:
|
part_type | Enum8 | part 类型,枚举值包括:
|
data_type | String | 数据类型。 |
layout_type | String | 存储布局类型。 |
part_id | UUID | part 的唯一 UUID 标识。 |
commit_ts | UInt64 | part 在事务中的提交时间戳。 |
end_ts | UInt64 | part 被标记为不可用的时间戳,如被 truncate 或 merge 操作触发。 |
last_modification_time | DateTime | part 最后一次被修改的时间。 |
active | UInt8 | part 是否可用:
|
bytes | UInt64 | part 的逻辑数据大小,单位为字节。 |
rows | UInt64 | part 的逻辑行数。 |
以下示例展示了查询表 order_details 的系统表 system.cnch_parts:
SELECT * FROM system.cnch_parts WHERE database = 'sales_db' -- 替换为您需要查询的表所在的数据库名 AND table = 'order_details'; -- 替换为您需要查询的表名
查询结果示例: