diff --git a/statistics.md b/statistics.md index a94af430916fc..ca8b4d54a902c 100644 --- a/statistics.md +++ b/statistics.md @@ -11,8 +11,9 @@ TiDB uses statistics to decide [which index to choose](/choose-index.md). The `tidb_analyze_version` variable controls the statistics collected by TiDB. Currently, two versions of statistics are supported: `tidb_analyze_version = 1` and `tidb_analyze_version = 2`. -- For TiDB Self-Hosted, the default value of this variable is `1` before v5.1.0. In v5.3.0 and later versions, the default value of this variable is `2`. If your cluster is upgraded from a version earlier than v5.3.0 to v5.3.0 or later, the default value of `tidb_analyze_version` does not change. -- For TiDB Cloud, the default value of this variable is `1`. +- For TiDB Self-Hosted, the default value of this variable changes from `1` to `2` starting from v5.3.0. +- For TiDB Cloud, the default value of this variable changes from `1` to `2` starting from v6.5.0. +- If your cluster is upgraded from an earlier version, the default value of `tidb_analyze_version` does not change after the upgrade. Compared to Version 1, Version 2 statistics avoids the potential inaccuracy caused by hash collision when the data volume is huge. It also maintains the estimate precision in most scenarios. diff --git a/system-variables.md b/system-variables.md index 34a3dfb97f7df..de12a92501147 100644 --- a/system-variables.md +++ b/system-variables.md @@ -1080,21 +1080,13 @@ MPP is a distributed computing framework provided by the TiFlash engine, which a - Persists to cluster: Yes - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No - Type: Integer -- Default value: `2` for TiDB Self-Hosted and `1` for TiDB Cloud +- Default value: `2` - Range: `[1, 2]` - Controls how TiDB collects statistics. - - - -- In v5.3.0 and later versions, the default value of this variable is `2`. If your cluster is upgraded from a version earlier than v5.3.0 to v5.3.0 or later, the default value of `tidb_analyze_version` does not change. For detailed introduction, see [Introduction to Statistics](/statistics.md). - - - - - -- For detailed introduction of this variable, see [Introduction to Statistics](/statistics.md). - - + - For TiDB Self-Hosted, the default value of this variable changes from `1` to `2` starting from v5.3.0. + - For TiDB Cloud, the default value of this variable changes from `1` to `2` starting from v6.5.0. + - If your cluster is upgraded from an earlier version, the default value of `tidb_analyze_version` does not change after the upgrade. +- For detailed introduction about this variable, see [Introduction to Statistics](/statistics.md). ### tidb_analyze_skip_column_types New in v7.2.0