Skip to content

Commit

Permalink
cloud: update the default value of tidb_analyze_version (#15067) (#15081
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ti-chi-bot authored Oct 16, 2023
1 parent 6ccc4e7 commit ddde8bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
5 changes: 3 additions & 2 deletions statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
18 changes: 5 additions & 13 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
<CustomContent platform="tidb">
- 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).
</CustomContent>
<CustomContent platform="tidb-cloud">
- For detailed introduction of this variable, see [Introduction to Statistics](/statistics.md).
</CustomContent>
- 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 <span class="version-mark">New in v7.2.0</span>
Expand Down

0 comments on commit ddde8bd

Please sign in to comment.