Sign InTry Free

TIKV_REGION_STATUS

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.

USE information_schema; DESC tikv_region_status;
+---------------------------+-------------+------+------+---------+-------+ | 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 | | | 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 | | +---------------------------+-------------+------+------+---------+-------+ 17 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 which TABLE_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, and IS_INDEX is 0 and 1 respectively.
  • INDEX_ID: The ID of the index to which the Region belongs. If IS_INDEX is 0, the value of this column is NULL.
  • INDEX_NAME: The name of the index to which the Region belongs. If IS_INDEX is 0, the value of this column is NULL.
  • 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 be UNKNOWN, SIMPLE_MAJORITY, or INTEGRITY_OVER_LABEL.
  • REPLICATIONSTATUS_STATEID: The identifier corresponding to REPLICATIONSTATUS_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;

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.