Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 怎么查看一张表自创建后region的变动及分布情况
[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version] 7.1
[Reproduction Path] Is there a way to quickly view the current and historical region changes of a table, either through SQL or charts?
[Encountered Problem: Problem Phenomenon and Impact]
[Resource Configuration] 3-node testing environment
[Attachment: Screenshots / Logs / Monitoring]
The historical data cannot be seen, but the current data can be viewed.
#### SHOW TABLE REGIONS
The historical data might not be visible unless you collect it regularly.
You can take a look at a few tables in the METRICS_SCHEMA database with the command >show tables like ‘%region%’; Not sure if it meets your needs.
There is no record of historical changes, you can monitor it yourself regularly.
You can only see the current ones, you probably can’t see the historical ones.
You can view the current SHOW TABLE REGIONS, but not the historical ones.
It seems there are no historical queries.
This should be similar to Oracle monitoring tablespace historical usage rate, you need to add monitoring yourself.
Incremental collection to create a report.
You can use the information_schema.TIKV_REGION_STATUS
table to obtain the distribution of Regions in a table, including information such as the Region ID, start key, end key, and Leader node.
How about trying scheduled collection and processing with SHOW TABLE REGIONS
?
Consider using monitoring for data collection.
Use SHOW TABLE REGIONS
to find the region ID, then look for the corresponding operator in the PD leader log based on the region ID. The operator contains region scheduling information.
Automatically collect and save to the table at regular intervals.