Sudden Increase in the Number of Regions

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

Original topic: region 数量陡然上升

| username: TiDBer_vFs1A6CZ

[TiDB Usage Environment] Production Environment
[TiDB Version] 6.5.1
[Reproduction Path] Operations performed that led to the issue: Increased the tidb_mem_quota_query parameter to 35G
[Encountered Issue: Phenomenon and Impact] Starting from 4 AM, the number of regions has been consistently increasing, and the memory usage of TiKV has been continuously rising.
[Resource Configuration] Navigate to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page

[Attachments: Screenshots/Logs/Monitoring]

| username: xfworld | Original post link

The increase in regions is related to data and not necessarily related to memory.

Check if the empty regions are within the normal range.

| username: 像风一样的男子 | Original post link

Are there any errors reported in the KV logs?

| username: tidb菜鸟一只 | Original post link

The increase in regions should not be related to the tidb_mem_quota_query parameter being set to 35G. Is it possible that data was inserted in batches?

| username: zhanggame1 | Original post link

First, check which table has an increase in data volume.
You can view it through this table: TIKV_REGION_STATUS | PingCAP 文档中心

| username: 大飞哥online | Original post link

tidb_mem_quota_query is related to memory and cache capacity, and it is not necessarily related to the increase in region data.

| username: TiDBer_vFs1A6CZ | Original post link

The reason for the empty region
Monitoring the number of empty regions shows that the number of empty regions started to increase around 4 AM on October 9th.
Around 2 AM on October 9th, the number of empty regions began to decrease until it returned to normal.

Corresponding memory usage has decreased, but in the end, each TiKV still increased by about 5G. Is this normal?

Next time you encounter a rapid increase in empty regions, is there any way to prevent it from rising quickly?

| username: xfworld | Original post link

Deleting data will inevitably generate empty regions. The only solution is to speed up the merging process.

However, you need to first check the configuration to see if it meets the merging requirements:

Refer to the above links.