The start and end time settings for tidb_auto_analyze_start_time are not effective

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

Original topic: tidb_auto_analyze_start_time 开始和结束时间设置不生效

| username: jiangdj1992

【TiDB Usage Environment】Production Environment
【TiDB Version】4.0.8
【Reproduction Path】Operations performed that led to the issue
【Encountered Issue: Phenomenon and Impact】Linux system timezone is set to UTC+8, setting analyze time range is ineffective, analyze during the day affects service performance
【Resource Configuration】Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
【Attachments: Screenshots/Logs/Monitoring】

| username: 有猫万事足 | Original post link

tiup cluster exec [cluster-name] --command='timedatectl'

Let’s see the result.

| username: Miracle | Original post link

Is it possible that the number of rows modified in the table has not reached the update threshold?

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

Execute SELECT @@global.time_zone, @@session.time_zone, @@global.system_time_zone; to check.

| username: jiangdj1992 | Original post link

All machines are
stdout:
Local time: Tue 2023-09-12 10:01:31 CST
Universal time: Tue 2023-09-12 02:01:31 UTC
RTC time: Tue 2023-09-12 02:01:31
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a

| username: jiangdj1992 | Original post link

mysql> SELECT @@global.time_zone, @@session.time_zone, @@global.system_time_zone;
±-------------------±--------------------±--------------------------+
| @@global.time_zone | @@session.time_zone | @@global.system_time_zone |
±-------------------±--------------------±--------------------------+
| SYSTEM | SYSTEM | Asia/Shanghai |
±-------------------±--------------------------+
1 row in set (0.01 sec)

| username: jiangdj1992 | Original post link

No, the analyze time at the bottom of the above picture is not within the time limit.

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

Is this time zone correct? Did you set these parameters yesterday?

| username: jiangdj1992 | Original post link

I set it up a long time ago. Yesterday, I changed 0800 to 0000 and tried it.

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

Did you change it to 22:00 +0000 to 06:00 +0000 yesterday? Isn’t that 06:00 +0800 to 14:00 +0800?

| username: jiangdj1992 | Original post link

Normally, it is like this. I need to observe the execution effect further.

| username: 有猫万事足 | Original post link

There is no problem with the function that determines the time interval.

It supports the format from 22:00 to 06:00.

So the suspicion turns towards a bug.
Then I found this

And this bug was not fixed until version 5.2.2, the fix for version 4.x was rejected.

| username: jiangdj1992 | Original post link

I’m not quite sure. In some of my test environments, it works, and the versions are the same. :smile: I’m also a bit confused.