How to Check the Changes and Distribution of Regions for a Table Since Its Creation

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 怎么查看一张表自创建后region的变动及分布情况

| username: 数据源的TiDB学习之路

[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]

| username: TiDBer_jYQINSnf | Original post link

The historical data cannot be seen, but the current data can be viewed.
#### SHOW TABLE REGIONS

| username: dba远航 | Original post link

The historical data might not be visible unless you collect it regularly.

| username: DBAER | Original post link

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.

| username: 小龙虾爱大龙虾 | Original post link

There is no record of historical changes, you can monitor it yourself regularly.

| username: terry0219 | Original post link

You can only see the current ones, you probably can’t see the historical ones.

| username: TiDBer_QYr0vohO | Original post link

You can view the current SHOW TABLE REGIONS, but not the historical ones.

| username: TiDBer_fbU009vH | Original post link

It seems there are no historical queries.

| username: Kamner | Original post link

This should be similar to Oracle monitoring tablespace historical usage rate, you need to add monitoring yourself.

| username: wangkk2024 | Original post link

Can’t see the history.

| username: 友利奈绪 | Original post link

Incremental collection to create a report.

| username: TiDBer_ivan0927 | Original post link

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.

| username: 这里介绍不了我 | Original post link

How about trying scheduled collection and processing with SHOW TABLE REGIONS?

| username: Jack-li | Original post link

Consider using monitoring for data collection.

| username: h5n1 | Original post link

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.

| username: zhaokede | Original post link

Automatically collect and save to the table at regular intervals.