From 09cb419fb0a8a46671a8945d53485ec8829dbe5f Mon Sep 17 00:00:00 2001 From: JaySon-Huang Date: Wed, 23 Apr 2025 18:03:28 +0800 Subject: [PATCH 1/2] Update tiflash system tables Signed-off-by: JaySon-Huang --- .../information-schema-tiflash-indexes.md | 55 +++++++++++++++++ .../information-schema-tiflash-segments.md | 59 +++++++++---------- .../information-schema-tiflash-tables.md | 55 ++++++++--------- information-schema/information-schema.md | 7 ++- 4 files changed, 112 insertions(+), 64 deletions(-) create mode 100644 information-schema/information-schema-tiflash-indexes.md diff --git a/information-schema/information-schema-tiflash-indexes.md b/information-schema/information-schema-tiflash-indexes.md new file mode 100644 index 000000000000..6ea56aa67ba3 --- /dev/null +++ b/information-schema/information-schema-tiflash-indexes.md @@ -0,0 +1,55 @@ +--- +title: TIFLASH_INDEXES +summary: 了解 information_schema 表 `TIFLASH_INDEXES`。 +--- + +# TIFLASH_TABLES + +> **警告:** +> +> 请不要在生产环境中使用该系统表,因为该表字段信息尚未固定下来,可能会在 TiDB 未来版本中发生变化。 + +`TIFLASH_INDEXES` 表提供有关 TiFlash 副本上索引构建的的统计信息。 + +```sql +USE information_schema; +DESC tiflash_indexes; +``` + +```sql ++-------------------------+---------------+------+------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------------------------+---------------+------+------+---------+-------+ +| TIDB_DATABASE | varchar(64) | YES | | NULL | | +| TIDB_TABLE | varchar(64) | YES | | NULL | | +| TABLE_ID | bigint | YES | | NULL | | +| COLUMN_NAME | varchar(64) | YES | | NULL | | +| INDEX_NAME | varchar(64) | YES | | NULL | | +| COLUMN_ID | bigint | YES | | NULL | | +| INDEX_ID | bigint | YES | | NULL | | +| INDEX_KIND | varchar(64) | YES | | NULL | | +| ROWS_STABLE_INDEXED | bigint | YES | | NULL | | +| ROWS_STABLE_NOT_INDEXED | bigint | YES | | NULL | | +| ROWS_DELTA_INDEXED | bigint | YES | | NULL | | +| ROWS_DELTA_NOT_INDEXED | bigint | YES | | NULL | | +| ERROR_MESSAGE | varchar(1024) | YES | | NULL | | +| TIFLASH_INSTANCE | varchar(64) | YES | | NULL | | ++-------------------------+---------------+------+------+---------+-------+ +``` + +`TIFLASH_INDEXES` 表中各列的字段含义如下: + +- `TIDB_DATABASE`:表所属的数据库的名称。 +- `TIDB_TABLE`:表的名称。 +- `TABLE_ID`:表的内部 ID,该 ID 在一个 TiDB 集群内部唯一。 +- `COLUMN_NAME`:索引所在的列名 +- `INDEX_NAME`:索引的名称 +- `COLUMN_ID`:索引所在的列 ID +- `INDEX_ID`:索引的 ID +- `INDEX_KIND`:索引的类型 +- `ROWS_STABLE_INDEXED`:TiFlash 副本中 Stable 层已经构建完索引的行数 +- `ROWS_STABLE_NOT_INDEXED`:TiFlash 副本中 Stable 层未构建索引的行数 +- `ROWS_DELTA_INDEXED`:TiFlash 副本中 Delta 层已经构建完索引的行数 +- `ROWS_DELTA_NOT_INDEXED`:TiFlash 副本中 Delta 层未构建索引的行数 +- `ERROR_MESSAGE`:索引构建过程中遇到不可恢复的错误信息 +- `TIFLASH_INSTANCE`:TiFlash 实例地址。 diff --git a/information-schema/information-schema-tiflash-segments.md b/information-schema/information-schema-tiflash-segments.md index 78841ab5a096..ec73960435b9 100644 --- a/information-schema/information-schema-tiflash-segments.md +++ b/information-schema/information-schema-tiflash-segments.md @@ -9,7 +9,7 @@ summary: 了解 information_schema 表 `TIFLASH_SEGMENTS`。 > > 请不要在生产环境中使用该系统表,因为该表字段信息尚未固定下来,可能会在 TiDB 未来版本中发生变化。 -`TIFLASH_SEGMENTS` 表提供了 TiFlash 内部数据表的统计信息。 +`TIFLASH_SEGMENTS` 表提供了 TiFlash 内部数据表内分片(Segment)的统计信息。 ```sql USE information_schema; @@ -20,47 +20,42 @@ DESC tiflash_segments; +-------------------------------+-------------+------+------+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------------------+-------------+------+------+---------+-------+ -| DATABASE | varchar(64) | YES | | NULL | | -| TABLE | varchar(64) | YES | | NULL | | | TIDB_DATABASE | varchar(64) | YES | | NULL | | | TIDB_TABLE | varchar(64) | YES | | NULL | | -| TABLE_ID | bigint(64) | YES | | NULL | | -| IS_TOMBSTONE | bigint(64) | YES | | NULL | | -| SEGMENT_ID | bigint(64) | YES | | NULL | | +| TABLE_ID | bigint | YES | | NULL | | +| IS_TOMBSTONE | bigint | YES | | NULL | | +| SEGMENT_ID | bigint | YES | | NULL | | | RANGE | varchar(64) | YES | | NULL | | -| EPOCH | bigint(64) | YES | | NULL | | -| ROWS | bigint(64) | YES | | NULL | | -| SIZE | bigint(64) | YES | | NULL | | +| EPOCH | bigint | YES | | NULL | | +| ROWS | bigint | YES | | NULL | | +| SIZE | bigint | YES | | NULL | | | DELTA_RATE | double | YES | | NULL | | -| DELTA_MEMTABLE_ROWS | bigint(64) | YES | | NULL | | -| DELTA_MEMTABLE_SIZE | bigint(64) | YES | | NULL | | -| DELTA_MEMTABLE_COLUMN_FILES | bigint(64) | YES | | NULL | | -| DELTA_MEMTABLE_DELETE_RANGES | bigint(64) | YES | | NULL | | -| DELTA_PERSISTED_PAGE_ID | bigint(64) | YES | | NULL | | -| DELTA_PERSISTED_ROWS | bigint(64) | YES | | NULL | | -| DELTA_PERSISTED_SIZE | bigint(64) | YES | | NULL | | -| DELTA_PERSISTED_COLUMN_FILES | bigint(64) | YES | | NULL | | -| DELTA_PERSISTED_DELETE_RANGES | bigint(64) | YES | | NULL | | -| DELTA_CACHE_SIZE | bigint(64) | YES | | NULL | | -| DELTA_INDEX_SIZE | bigint(64) | YES | | NULL | | -| STABLE_PAGE_ID | bigint(64) | YES | | NULL | | -| STABLE_ROWS | bigint(64) | YES | | NULL | | -| STABLE_SIZE | bigint(64) | YES | | NULL | | -| STABLE_DMFILES | bigint(64) | YES | | NULL | | -| STABLE_DMFILES_ID_0 | bigint(64) | YES | | NULL | | -| STABLE_DMFILES_ROWS | bigint(64) | YES | | NULL | | -| STABLE_DMFILES_SIZE | bigint(64) | YES | | NULL | | -| STABLE_DMFILES_SIZE_ON_DISK | bigint(64) | YES | | NULL | | -| STABLE_DMFILES_PACKS | bigint(64) | YES | | NULL | | +| DELTA_MEMTABLE_ROWS | bigint | YES | | NULL | | +| DELTA_MEMTABLE_SIZE | bigint | YES | | NULL | | +| DELTA_MEMTABLE_COLUMN_FILES | bigint | YES | | NULL | | +| DELTA_MEMTABLE_DELETE_RANGES | bigint | YES | | NULL | | +| DELTA_PERSISTED_PAGE_ID | bigint | YES | | NULL | | +| DELTA_PERSISTED_ROWS | bigint | YES | | NULL | | +| DELTA_PERSISTED_SIZE | bigint | YES | | NULL | | +| DELTA_PERSISTED_COLUMN_FILES | bigint | YES | | NULL | | +| DELTA_PERSISTED_DELETE_RANGES | bigint | YES | | NULL | | +| DELTA_CACHE_SIZE | bigint | YES | | NULL | | +| DELTA_INDEX_SIZE | bigint | YES | | NULL | | +| STABLE_PAGE_ID | bigint | YES | | NULL | | +| STABLE_ROWS | bigint | YES | | NULL | | +| STABLE_SIZE | bigint | YES | | NULL | | +| STABLE_DMFILES | bigint | YES | | NULL | | +| STABLE_DMFILES_ID_0 | bigint | YES | | NULL | | +| STABLE_DMFILES_ROWS | bigint | YES | | NULL | | +| STABLE_DMFILES_SIZE | bigint | YES | | NULL | | +| STABLE_DMFILES_SIZE_ON_DISK | bigint | YES | | NULL | | +| STABLE_DMFILES_PACKS | bigint | YES | | NULL | | | TIFLASH_INSTANCE | varchar(64) | YES | | NULL | | +-------------------------------+-------------+------+------+---------+-------+ -33 rows in set (0.00 sec) ``` `TIFLASH_SEGMENTS` 表中各列的字段含义如下: -- `DATABASE`:Segment 所属表在 TiFlash 内部所属的数据库的名称。 -- `TABLE`:Segment 所属表在 TiFlash 内部的名称。 - `TIDB_DATABASE`:Segment 所属表所属的数据库的名称。 - `TIDB_TABLE`:Segment 所属表的名称。 - `TABLE_ID`:Segment 所属表的内部 ID,该 ID 在一个 TiDB 集群内部唯一。 diff --git a/information-schema/information-schema-tiflash-tables.md b/information-schema/information-schema-tiflash-tables.md index eed2af3ad6d6..34eeab467815 100644 --- a/information-schema/information-schema-tiflash-tables.md +++ b/information-schema/information-schema-tiflash-tables.md @@ -20,68 +20,63 @@ DESC tiflash_tables; +-------------------------------------------+--------------+------+------+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------------------------------+--------------+------+------+---------+-------+ -| DATABASE | varchar(64) | YES | | NULL | | -| TABLE | varchar(64) | YES | | NULL | | | TIDB_DATABASE | varchar(64) | YES | | NULL | | | TIDB_TABLE | varchar(64) | YES | | NULL | | -| TABLE_ID | bigint(64) | YES | | NULL | | -| IS_TOMBSTONE | bigint(64) | YES | | NULL | | -| SEGMENT_COUNT | bigint(64) | YES | | NULL | | -| TOTAL_ROWS | bigint(64) | YES | | NULL | | -| TOTAL_SIZE | bigint(64) | YES | | NULL | | -| TOTAL_DELETE_RANGES | bigint(64) | YES | | NULL | | +| TABLE_ID | bigint | YES | | NULL | | +| IS_TOMBSTONE | bigint | YES | | NULL | | +| SEGMENT_COUNT | bigint | YES | | NULL | | +| TOTAL_ROWS | bigint | YES | | NULL | | +| TOTAL_SIZE | bigint | YES | | NULL | | +| TOTAL_DELETE_RANGES | bigint | YES | | NULL | | | DELTA_RATE_ROWS | double | YES | | NULL | | | DELTA_RATE_SEGMENTS | double | YES | | NULL | | | DELTA_PLACED_RATE | double | YES | | NULL | | -| DELTA_CACHE_SIZE | bigint(64) | YES | | NULL | | +| DELTA_CACHE_SIZE | bigint | YES | | NULL | | | DELTA_CACHE_RATE | double | YES | | NULL | | | DELTA_CACHE_WASTED_RATE | double | YES | | NULL | | -| DELTA_INDEX_SIZE | bigint(64) | YES | | NULL | | +| DELTA_INDEX_SIZE | bigint | YES | | NULL | | | AVG_SEGMENT_ROWS | double | YES | | NULL | | | AVG_SEGMENT_SIZE | double | YES | | NULL | | -| DELTA_COUNT | bigint(64) | YES | | NULL | | -| TOTAL_DELTA_ROWS | bigint(64) | YES | | NULL | | -| TOTAL_DELTA_SIZE | bigint(64) | YES | | NULL | | +| DELTA_COUNT | bigint | YES | | NULL | | +| TOTAL_DELTA_ROWS | bigint | YES | | NULL | | +| TOTAL_DELTA_SIZE | bigint | YES | | NULL | | | AVG_DELTA_ROWS | double | YES | | NULL | | | AVG_DELTA_SIZE | double | YES | | NULL | | | AVG_DELTA_DELETE_RANGES | double | YES | | NULL | | -| STABLE_COUNT | bigint(64) | YES | | NULL | | -| TOTAL_STABLE_ROWS | bigint(64) | YES | | NULL | | -| TOTAL_STABLE_SIZE | bigint(64) | YES | | NULL | | -| TOTAL_STABLE_SIZE_ON_DISK | bigint(64) | YES | | NULL | | +| STABLE_COUNT | bigint | YES | | NULL | | +| TOTAL_STABLE_ROWS | bigint | YES | | NULL | | +| TOTAL_STABLE_SIZE | bigint | YES | | NULL | | +| TOTAL_STABLE_SIZE_ON_DISK | bigint | YES | | NULL | | | AVG_STABLE_ROWS | double | YES | | NULL | | | AVG_STABLE_SIZE | double | YES | | NULL | | -| TOTAL_PACK_COUNT_IN_DELTA | bigint(64) | YES | | NULL | | -| MAX_PACK_COUNT_IN_DELTA | bigint(64) | YES | | NULL | | +| TOTAL_PACK_COUNT_IN_DELTA | bigint | YES | | NULL | | +| MAX_PACK_COUNT_IN_DELTA | bigint | YES | | NULL | | | AVG_PACK_COUNT_IN_DELTA | double | YES | | NULL | | | AVG_PACK_ROWS_IN_DELTA | double | YES | | NULL | | | AVG_PACK_SIZE_IN_DELTA | double | YES | | NULL | | -| TOTAL_PACK_COUNT_IN_STABLE | bigint(64) | YES | | NULL | | +| TOTAL_PACK_COUNT_IN_STABLE | bigint | YES | | NULL | | | AVG_PACK_COUNT_IN_STABLE | double | YES | | NULL | | | AVG_PACK_ROWS_IN_STABLE | double | YES | | NULL | | | AVG_PACK_SIZE_IN_STABLE | double | YES | | NULL | | -| STORAGE_STABLE_NUM_SNAPSHOTS | bigint(64) | YES | | NULL | | +| STORAGE_STABLE_NUM_SNAPSHOTS | bigint | YES | | NULL | | | STORAGE_STABLE_OLDEST_SNAPSHOT_LIFETIME | double | YES | | NULL | | -| STORAGE_STABLE_OLDEST_SNAPSHOT_THREAD_ID | bigint(64) | YES | | NULL | | +| STORAGE_STABLE_OLDEST_SNAPSHOT_THREAD_ID | bigint | YES | | NULL | | | STORAGE_STABLE_OLDEST_SNAPSHOT_TRACING_ID | varchar(128) | YES | | NULL | | -| STORAGE_DELTA_NUM_SNAPSHOTS | bigint(64) | YES | | NULL | | +| STORAGE_DELTA_NUM_SNAPSHOTS | bigint | YES | | NULL | | | STORAGE_DELTA_OLDEST_SNAPSHOT_LIFETIME | double | YES | | NULL | | -| STORAGE_DELTA_OLDEST_SNAPSHOT_THREAD_ID | bigint(64) | YES | | NULL | | +| STORAGE_DELTA_OLDEST_SNAPSHOT_THREAD_ID | bigint | YES | | NULL | | | STORAGE_DELTA_OLDEST_SNAPSHOT_TRACING_ID | varchar(128) | YES | | NULL | | -| STORAGE_META_NUM_SNAPSHOTS | bigint(64) | YES | | NULL | | +| STORAGE_META_NUM_SNAPSHOTS | bigint | YES | | NULL | | | STORAGE_META_OLDEST_SNAPSHOT_LIFETIME | double | YES | | NULL | | -| STORAGE_META_OLDEST_SNAPSHOT_THREAD_ID | bigint(64) | YES | | NULL | | +| STORAGE_META_OLDEST_SNAPSHOT_THREAD_ID | bigint | YES | | NULL | | | STORAGE_META_OLDEST_SNAPSHOT_TRACING_ID | varchar(128) | YES | | NULL | | -| BACKGROUND_TASKS_LENGTH | bigint(64) | YES | | NULL | | +| BACKGROUND_TASKS_LENGTH | bigint | YES | | NULL | | | TIFLASH_INSTANCE | varchar(64) | YES | | NULL | | +-------------------------------------------+--------------+------+------+---------+-------+ -54 rows in set (0.00 sec) ``` `TIFLASH_TABLES` 表中各列的字段含义如下: -- `DATABASE`:表在 TiFlash 内部所属的数据库的名称。 -- `TABLE`:表在 TiFlash 内部的名称。 - `TIDB_DATABASE`:表所属的数据库的名称。 - `TIDB_TABLE`:表的名称。 - `TABLE_ID`:表的内部 ID,该 ID 在一个 TiDB 集群内部唯一。 diff --git a/information-schema/information-schema.md b/information-schema/information-schema.md index 3df585ab4aed..73a14efdfb8b 100644 --- a/information-schema/information-schema.md +++ b/information-schema/information-schema.md @@ -96,8 +96,11 @@ Information Schema 提供了一种查看系统元数据的 ANSI 标准方法。 | [`TIDB_INDEXES`](/information-schema/information-schema-tidb-indexes.md) | 提供有关 TiDB 表的索引信息。 | | [`TIDB_INDEX_USAGE`](/information-schema/information-schema-tidb-index-usage.md) | 提供 TiDB 节点上有关访问索引的统计信息。 | | [`TIDB_SERVERS_INFO`](/information-schema/information-schema-tidb-servers-info.md) | 提供 TiDB 服务器的列表 | -| [`TIDB_TRX`](/information-schema/information-schema-tidb-trx.md) | 提供 TiDB 节点上正在执行的事务的信息。 | +| [`TIDB_TRX`](/information-schema/information-schema-tidb-trx.md) | 提供 TiDB 节点上正在执行的事务的信息。 | +| [`TIFLASH_INDEXES`](/information-schema/information-schema-tiflash-indexes.md) | 提供有关 TiFlash 副本上索引构建的的统计信息。 | | [`TIFLASH_REPLICA`](/information-schema/information-schema-tiflash-replica.md) | 提供有关 TiFlash 副本的详细信息。 | +| [`TIFLASH_SEGMENTS`](/information-schema/information-schema-tiflash-segments.md) | 提供有关 TiFlash 内部数据表内分片(Segment)的统计信息。 | +| [`TIFLASH_TABLES`](/information-schema/information-schema-tiflash-tables.md) | 提供有关 TiFlash 内部数据表的统计信息。 | | [`TIKV_REGION_PEERS`](/information-schema/information-schema-tikv-region-peers.md) | 提供 Region 存储位置的详细信息。 | -| [`TIKV_REGION_STATUS`](/information-schema/information-schema-tikv-region-status.md) | 提供 Region 的统计信息。 | +| [`TIKV_REGION_STATUS`](/information-schema/information-schema-tikv-region-status.md) | 提供 Region 的统计信息。 | | [`TIKV_STORE_STATUS`](/information-schema/information-schema-tikv-store-status.md) | 提供 TiKV 服务器的基本信息。 | From f4f988b4d101a1a5781f57a211df0df676e2f532 Mon Sep 17 00:00:00 2001 From: JaySon Date: Thu, 24 Apr 2025 12:31:24 +0800 Subject: [PATCH 2/2] Update information-schema/information-schema-tiflash-indexes.md Co-authored-by: joey-yez <104608045+joey-yez@users.noreply.github.com> --- information-schema/information-schema-tiflash-indexes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/information-schema/information-schema-tiflash-indexes.md b/information-schema/information-schema-tiflash-indexes.md index 6ea56aa67ba3..0654752342c6 100644 --- a/information-schema/information-schema-tiflash-indexes.md +++ b/information-schema/information-schema-tiflash-indexes.md @@ -3,7 +3,7 @@ title: TIFLASH_INDEXES summary: 了解 information_schema 表 `TIFLASH_INDEXES`。 --- -# TIFLASH_TABLES +# TIFLASH_INDEXES > **警告:** >