Why is the hotspot concentrated on one TiKV node and not distributed to other TiKV nodes?

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

Original topic: 读热点为什么在一个tikv节点上,没有均摊到其他tikv节点上去

| username: 重启试试

[TiDB Usage Environment] Production Environment
[TiDB Version] 4.0.10

When migrating data from a large table, the operations are as follows:

  1. Query data from table A within a certain time period, limit 500, and write it to another database.
  2. Delete the 500 rows of records just queried from TiDB.

Each execution time plus pause time is about 2 seconds. This table generates a large number of read hotspots. From the monitoring, the CPU of one of the 5 TiKV nodes continues to rise, while the other 4 nodes show no significant changes. This pattern persists while migrating tens of millions of data. Logically, the data leader of a table should not all fall on one node, right?

| username: xfworld | Original post link

It is related to the setting of regions, which is also related to the table structure. I suggest you take a look at clustered indexes and non-clustered indexes.

You need to plan ahead for what kind of scenarios they are suitable for.

| username: TiDBer_jYQINSnf | Original post link

You can check which region corresponds to the table. Take a look.

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

You can also use this SQL to check.

| username: 重启试试 | Original post link

From the table structure, it should be a clustered index. Will a clustered index cause all the leaders of a table to be on one KV node?

| username: caiyfc | Original post link

If you want to solve the problem, you can check the execution plan of the related SQL for this table to see if there is room for optimization.

| username: xfworld | Original post link

I sent you the documentation. Take a good look and you’ll know how to solve it.

| username: dbaspace | Original post link

How do you delete it? Does the WHERE clause have an index?

| username: 重启试试 | Original post link

Thank you very much.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.