tidb: add the refresh stats statement#21598
Conversation
Synced from: pingcap/docs#21873 Target PR: pingcap#21598 AI Provider: azure Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
Auto-sync completed successfully Source PR: pingcap/docs#21873 Chinese documentation has been updated based on English documentation changes. |
9b7b077 to
2182627
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| - [`PREPARE`](/sql-statements/sql-statement-prepare.md) | ||
| - [`QUERY WATCH`](/sql-statements/sql-statement-query-watch.md) | ||
| - [`RECOVER TABLE`](/sql-statements/sql-statement-recover-table.md) | ||
| - [`刷新统计信息`](/sql-statements/sql-statement-refresh-stats.md) |
There was a problem hiding this comment.
| - [`刷新统计信息`](/sql-statements/sql-statement-refresh-stats.md) | |
| - [`REFRESH STATS`](/sql-statements/sql-statement-refresh-stats.md) |
|
|
||
| - **Targets(`RefreshTargetList`)**: | ||
| - `table_name`:刷新当前数据库中的指定表。 | ||
| - `db_name.table_name`:刷新指定数据库中的指定表。。 |
There was a problem hiding this comment.
| - `db_name.table_name`:刷新指定数据库中的指定表。。 | |
| - `db_name.table_name`:刷新指定数据库中的指定表。 |
|
|
||
| ## 选项 | ||
|
|
||
| - **Targets(`RefreshTargetList`)**: |
There was a problem hiding this comment.
| - **Targets(`RefreshTargetList`)**: | |
| - **刷新目标(`RefreshTargetList`)**: |
| - `db_name.*`:刷新指定数据库中的所有表。 | ||
| - `*.*`:刷新集群中的所有表。 | ||
| - **`FULL`**:将完整的统计信息(例如直方图、TopN 和 CMSketch)加载到内存中,等同于针对本次操作将 [`lite-init-stats`](/tidb-configuration-file.md#lite-init-stats-new-in-v710) 设置为 `false`。当你需要立即获得完整统计信息时,可使用该选项。 | ||
| - **`LITE`**:执行轻量级初始化,等同于设置 `lite-init-stats = true`。该模式会跳过直方图和其他较重的数据结构的加载,直到真正需要时才进行加载。 |
There was a problem hiding this comment.
| - **`LITE`**:执行轻量级初始化,等同于设置 `lite-init-stats = true`。该模式会跳过直方图和其他较重的数据结构的加载,直到真正需要时才进行加载。 | |
| - **`LITE`**:执行轻量级初始化,等同于设置 `lite-init-stats = true`。该模式会跳过直方图等较重数据结构的加载,直到真正需要时才加载。 |
| - **`FULL`**:将完整的统计信息(例如直方图、TopN 和 CMSketch)加载到内存中,等同于针对本次操作将 [`lite-init-stats`](/tidb-configuration-file.md#lite-init-stats-new-in-v710) 设置为 `false`。当你需要立即获得完整统计信息时,可使用该选项。 | ||
| - **`LITE`**:执行轻量级初始化,等同于设置 `lite-init-stats = true`。该模式会跳过直方图和其他较重的数据结构的加载,直到真正需要时才进行加载。 | ||
| - **`CLUSTER`**:将刷新请求发送到所有 TiDB 服务器。如果不指定该选项,则只有接收到该语句的 TiDB 节点会重新加载其内存中的统计信息。 | ||
| - **默认模式**:如果既未指定 `FULL`,也未指定 `LITE`,TiDB 会使用 [`lite-init-stats`](/tidb-configuration-file.md#lite-init-stats-new-in-v710) 的当前值。 |
There was a problem hiding this comment.
| - **默认模式**:如果既未指定 `FULL`,也未指定 `LITE`,TiDB 会使用 [`lite-init-stats`](/tidb-configuration-file.md#lite-init-stats-new-in-v710) 的当前值。 | |
| - **默认模式**:如果既未指定 `FULL`,也未指定 `LITE`,TiDB 会使用 [`lite-init-stats`](/tidb-configuration-file.md#lite-init-stats-从-v710-版本开始引入) 的当前值。 |
| REFRESH STATS orders; | ||
| ``` | ||
|
|
||
| - 以轻量级初始化刷新 `sales` 中的所有表: |
There was a problem hiding this comment.
| - 以轻量级初始化刷新 `sales` 中的所有表: | |
| - 以轻量级初始化方式刷新 `sales` 中的所有表: |
|
|
||
| ## MySQL 兼容性 | ||
|
|
||
| `REFRESH STATS` 是 TiDB 特有的扩展,不属于 MySQL。 |
There was a problem hiding this comment.
| `REFRESH STATS` 是 TiDB 特有的扩展,不属于 MySQL。 | |
| `REFRESH STATS` 语句是 TiDB 对 MySQL 语法的扩展。 |
[LGTM Timeline notifier]Timeline:
|
First-time contributors' checklist
What is changed, added or deleted? (Required)
ref pingcap/tidb#61273
Added the documentation for the refresh stats statement.
Which TiDB version(s) do your changes apply to? (Required)
Tips for choosing the affected version(s):
By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.
For details, see tips for choosing the affected versions.
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?