Trigger strategy: auto analyze
is automatically triggered when the number of rows in a new table reaches 1000 and this table has no write operation within one minute.
When the ratio (the number of modified rows / the current total number of rows) is larger than tidb_auto_analyze_ratio
, the analyze
statement is automatically triggered. The default value of tidb_auto_analyze_ratio
is 0.5, indicating that this feature is enabled by default. To ensure safety, its minimum value is 0.3 when the feature is enabled, and it must be smaller than pseudo-estimate-ratio
whose default value is 0.8, otherwise pseudo statistics will be used for a period of time. It is recommended to set tidb_auto_analyze_ratio
to 0.5.
To disable auto analyze, use the system variable tidb_enable_auto_analyze
.