Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tidb 如何取消正在运行的auto analyze table操作?
[TiDB Usage Environment] Production Environment
[TiDB Version] 5.2.2
[Encountered Problem: Problem Phenomenon and Impact]
How to cancel the auto analyze table that is currently running in TiDB? The SQL execution time has increased significantly, affecting the business.
Automatic analyze table runs in a single thread, so it should not affect database performance. You can also adjust the analyze time:
SET GLOBAL tidb_auto_analyze_start_time='22:00 +0800';
SET GLOBAL tidb_auto_analyze_end_time='08:00 +0800';
Let it analyze the table during off-peak hours.
Run date -R
on the server to check the time zone. The time zone for China is +0800.
Okay, I’ll make some changes.
]# date -R
Wed, 13 Sep 2023 10:08:45 +0800
Stop the analysis for a day and see if it still times out. Why do I feel like it doesn’t have much to do with the analysis?
You can keep an eye on the slow queries in the Dashboard during this period, and the automatically analyzed queries will also be counted here.
The focus is not on the issue; I want to ask how to stop the currently running auto analyze table. 
Can the KILL statement be stopped?
auto analyze table, cannot see it in show processlist
This should be the specific statement executed, analyze table xxx.
No, the automatic analyze in TiDB cannot be seen in the show processlist, so you can’t directly kill the TiDB ID.
No way, when we used v5.1 to automatically analyze at night, we could see the statements in the Dashboard. Isn’t it the same logic?
DDL and DML will also be recorded in the slow query log, and you can see them in the dashboard. Analyze should be considered a DDL statement and will not be listed in the processlist.
Okay, I really didn’t notice it before.
After changing the execution time, is there still a delay during the previous time period?
After further analysis, the high latency issue still occurred after completing the analyze. It was eventually identified that there was a BR backup. After killing the BR process, the latency returned to normal levels
. However, I still want to know if there is a way to terminate the currently running auto analyze table operation.
The root cause of the high latency was ultimately not auto analyze table 