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.
{{< copyable "sql" >}}
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)
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;