Analyze the Automatic Execution Cycle Timing

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

Original topic: analyze 自动执行周期是什么时间点

| username: 艾琳逼哥索

What is the time point for the automatic execution cycle of the analysis in the background? Is it executed on the hour? Tech newbie

| username: Jellybean | Original post link

You can check the official documentation for the section on statistics, which provides a detailed introduction. Its execution will be determined by factors such as the number of rows in the table, the number of changed rows, and some parameters.

| username: 艾琳逼哥索 | Original post link

I know this trigger condition. What I want to ask is, once the trigger condition is met, at what time will it automatically execute? Is it executed on the hour every hour, or every half hour?

| username: forever | Original post link

The statistics information collection will be automatically executed within the set executable time. You can refer to: Introduction to Statistics | PingCAP Documentation Center

| username: Jellybean | Original post link

The system defaults to automatically updating the total number of rows and the number of modified rows in the table every 1 minute (adjustable). Therefore, during the check every minute, if it is found that the ratio of the number of modified rows to the total number of rows in a table exceeds the tidb_auto_analyze_ratio configuration value (default 50%), and the current time is within the specified time range, TiDB will automatically execute the ANALYZE statement in the background to update the statistics of this table.

To avoid frequent automatic updates due to small data modifications in small tables, TiDB will not trigger automatic updates for tables with fewer than 1000 rows.

| username: zhanggame1 | Original post link

The default is 1 minute to check if it can be triggered.

| username: redgame | Original post link

Okay, 1 Min

| username: 小于同学 | Original post link

One minute

| username: Kongdom | Original post link

Reading the documentation takes 20*3s, 60s, which means it will automatically update every minute.

| username: DBAER | Original post link

One minute

| username: Raymond | Original post link

Can this 1 minute be set? Is there a parameter for it?

| username: zhanggame1 | Original post link

Modify the TiDB configuration file parameters.

| username: Raymond | Original post link

Thank you, boss.