Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: tidb 5.1.0设置自动analyze的时间不起效果
To improve efficiency, please provide the following information. Clear problem descriptions can be resolved more quickly:
[TiDB Usage Environment] Production
[Overview] The automatic analyze time setting for TiDB 5.1.0 is not effective, as shown below:
mysql> show variables like ‘%analyze%’;
±-----------------------------±------------+
| Variable_name | Value |
±-----------------------------±------------+
| tidb_analyze_version | 2 |
| tidb_auto_analyze_end_time | 23:59 +0000 |
| tidb_auto_analyze_ratio | 0.5 |
| tidb_auto_analyze_start_time | 10:30 +0000 |
| tidb_enable_fast_analyze | OFF |
±-----------------------------±------------+
5 rows in set (0.01 sec)
However, checking mysql> SHOW ANALYZE STATUS\G
Table_schema: bidata
Table_name: dws_111111
Partition_name:
Job_info: auto analyze table
Processed_rows: 1281117
Start_time: 2022-07-24 07:50:17
End_time: 2022-07-24 07:51:11
State: finished
I found that it was executed before 10:30 AM. Shouldn’t it only be executed between 10:30 and 23:59 after setting it this way???
Question 2: The mechanism of auto analyze table is if you set a time range for automatic execution, when the data ratio of a table you update exceeds tidb_auto_analyze_ratio, if it is not within this time range, will it not automatically analyze the table first, put it in the queue, and then read the information in the queue for auto analyze table during the time range of 10:30-23:59? Or will it abandon the execution of auto analyze table directly if it is not within this time range?
[Background] What operations have been done
[Phenomenon] Business and database phenomena
[Problem] Current problems encountered
[Business Impact]
[TiDB Version]
[Application Software and Version]
[Attachments] Relevant logs and configuration information
- TiUP Cluster Display information
- TiUP Cluster Edit config information
Monitoring (https://metricstool.pingcap.com/)
- TiDB-Overview Grafana monitoring
- TiDB Grafana monitoring
- TiKV Grafana monitoring
- PD Grafana monitoring
- Corresponding module logs (including logs 1 hour before and after the issue)
If the question is about performance optimization or troubleshooting, please download the script and run it. Please select all and copy and paste the terminal output results for upload.