From 635e811afb644e5f3263696d3bf2c3ecb5072a25 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Mon, 16 Oct 2023 16:57:29 +0800 Subject: [PATCH] cloud: update the default value of tidb_analyze_version (#15067) (#15079) --- statistics.md | 5 +++-- system-variables.md | 18 +++++------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/statistics.md b/statistics.md index 4cb1342db26ce..ab33726f5cfca 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 b2e3928b7f208..f8559517c434d 100644 --- a/system-variables.md +++ b/system-variables.md @@ -940,21 +940,13 @@ MPP is a distributed computing framework provided by the TiFlash engine, which a - Scope: SESSION | GLOBAL - Persists to cluster: Yes - 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