Analyze Issues

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

Original topic: analyze问题

| username: yulei7633

The collection time for statistics is set as follows:

Theoretically, there should be no more statements collecting statistics during the day, but I still found analyze statements on the dashboard page. Screenshot as follows:

Why is this happening? Is the time format I set incorrect?

| username: yulei7633 | Original post link

Is there a problem with the time format I set?

| username: Miracle | Original post link

Is there a manual collection? Check the time zones of both the database and the server.

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

Manually collected, or there is an issue with the database time format.

| username: yulei7633 | Original post link

No manual statistics have been collected.
Server time zone:

The database time zone is using the system time zone: | time_zone | SYSTEM |

| username: yulei7633 | Original post link

I have not manually collected statistical information. The database time format uses the system’s, as mentioned above.

| username: Miracle | Original post link

The operating system is CST, and analyze is UTC. Is it not recognized?
How about changing them to be consistent?

| username: yulei7633 | Original post link

How exactly should this be modified?

| username: 裤衩儿飞上天 | Original post link

Take a look at the following related parameter configurations:

show variables like '%time_zone%';
| username: yulei7633 | Original post link

| username: 裤衩儿飞上天 | Original post link

  1. You can confirm the time zone of each server.
  2. You can try changing the time_zone to Asia/Shanghai.

Your system_time_zone is already set to Asia/Shanghai, so there shouldn’t be any issues theoretically. Try specifying the time_zone and see if it helps.

| username: yulei7633 | Original post link

I’ll take another look, thanks.

| username: 大飞哥online | Original post link

Is the cluster time normal?

| username: TiDBer_小阿飞 | Original post link

You haven’t changed the tidb_auto_analyze_ratio parameter, it’s set to 0.5. When the ratio of modified rows to total rows in a table tbl exceeds tidb_auto_analyze_ratio, the statistics will be automatically updated.

| username: TiDBer_小阿飞 | Original post link

When executing query statements, TiDB collects feedback information with a feedback-probability and uses it to update histograms and Count-Min Sketch. You can modify feedback-probability through the configuration file, and its default value is 0.05. Setting it to 0.0 can disable this feature.

Note

Setting feedback-probability to 0 in the configuration file will result in a failure and an error. You need to set it to 0.0 to disable feedback-probability.

| username: yulei7633 | Original post link

The cluster time is normal.

| username: yulei7633 | Original post link

My understanding is that after setting the time for automatic statistics updates, the updates will only occur within the set time frame. They will not automatically update just because the value meets the criteria for automatic updates; otherwise, what would be the point of setting the time?

| username: yulei7633 | Original post link

Keep the feedback-probability at its default setting; I still need the statistics. My goal is to gather statistics, but I want to do it at midnight and avoid collecting statistical information during the day.

| username: Kongdom | Original post link

:+1: There’s such a setting, I hadn’t noticed it before.

| username: system | Original post link

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