title | summary |
---|---|
TIKV_REGION_STATUS |
Learn the `TIKV_REGION_STATUS` information_schema table. |
The TIKV_REGION_STATUS
table shows some basic information of TiKV Regions via PD's API, like the Region ID, starting and ending key-values, and read and write traffic.
Note:
This table is not available on TiDB Serverless clusters.
USE INFORMATION_SCHEMA;
DESC TIKV_REGION_STATUS;
The output is as follows:
+---------------------------+-------------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------------------+-------------+------+------+---------+-------+
| REGION_ID | bigint(21) | YES | | NULL | |
| START_KEY | text | YES | | NULL | |
| END_KEY | text | YES | | NULL | |
| TABLE_ID | bigint(21) | YES | | NULL | |
| DB_NAME | varchar(64) | YES | | NULL | |
| TABLE_NAME | varchar(64) | YES | | NULL | |
| IS_INDEX | tinyint(1) | NO | | 0 | |
| INDEX_ID | bigint(21) | YES | | NULL | |
| INDEX_NAME | varchar(64) | YES | | NULL | |
| IS_PARTITION | tinyint(1) | NO | | 0 | |
| PARTITION_ID | bigint(21) | YES | | NULL | |
| PARTITION_NAME | varchar(64) | YES | | NULL | |
| EPOCH_CONF_VER | bigint(21) | YES | | NULL | |
| EPOCH_VERSION | bigint(21) | YES | | NULL | |
| WRITTEN_BYTES | bigint(21) | YES | | NULL | |
| READ_BYTES | bigint(21) | YES | | NULL | |
| APPROXIMATE_SIZE | bigint(21) | YES | | NULL | |
| APPROXIMATE_KEYS | bigint(21) | YES | | NULL | |
| REPLICATIONSTATUS_STATE | varchar(64) | YES | | NULL | |
| REPLICATIONSTATUS_STATEID | bigint(21) | YES | | NULL | |
+---------------------------+-------------+------+------+---------+-------+
20 rows in set (0.00 sec)
The descriptions of the columns in the TIKV_REGION_STATUS
table are as follows:
REGION_ID
: The ID of the Region.START_KEY
: The value of the start key of the Region.END_KEY
: The value of the end key of the Region.TABLE_ID
: The ID of the table to which the Region belongs.DB_NAME
: The name of the database to whichTABLE_ID
belongs.TABLE_NAME
: The name of the table to which the Region belongs.IS_INDEX
: Whether the Region data is an index. 0 means that it is not an index, while 1 means that it is an index. If the current Region contains both table data and index data, there will be multiple rows of records, andIS_INDEX
is 0 and 1 respectively.INDEX_ID
: The ID of the index to which the Region belongs. IfIS_INDEX
is 0, the value of this column is NULL.INDEX_NAME
: The name of the index to which the Region belongs. IfIS_INDEX
is 0, the value of this column is NULL.IS_PARTITION
: Whether the table to which the Region belongs is partitioned.PARTITION_ID
: If the table to which the Region belongs is partitioned, this column displays the ID of the partition to which the Region belongs.PARTITION_NAME
: If the table to which the Region belongs is partitioned, this column displays the name of the partition to which the Region belongs.EPOCH_CONF_VER
: The version number of the Region configuration. The version number increases when a peer is added or removed.EPOCH_VERSION
: The current version number of the Region. The version number increases when the Region is split or merged.WRITTEN_BYTES
: The amount of data (bytes) written to the Region.READ_BYTES
: The amount of data (bytes) that has been read from the Region.APPROXIMATE_SIZE
: The approximate data size (MB) of the Region.APPROXIMATE_KEYS
: The approximate number of keys in the Region.REPLICATIONSTATUS_STATE
: The current replication status of the Region. The status might beUNKNOWN
,SIMPLE_MAJORITY
, orINTEGRITY_OVER_LABEL
.REPLICATIONSTATUS_STATEID
: The identifier corresponding toREPLICATIONSTATUS_STATE
.
Also, you can implement the top confver
, top read
and top write
operations in pd-ctl via the ORDER BY X LIMIT Y
operation on the EPOCH_CONF_VER
, WRITTEN_BYTES
and READ_BYTES
columns.
You can query the top 3 Regions with the most write data using the following SQL statement:
SELECT * FROM tikv_region_status ORDER BY written_bytes DESC LIMIT 3;