statistics: add docs for the FLUSH STATS_DELTA statement#21819
Conversation
Synced from: pingcap/docs#23258 Target PR: pingcap#21819 AI Provider: azure Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
Auto-sync completed successfully Source PR: pingcap/docs#23258 Chinese documentation has been updated based on English documentation changes. |
|
[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 |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough新增 ChangesFLUSH STATS_DELTA 文档
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@sql-statements/sql-statement-flush-stats-delta.md`:
- Line 10: Correct the shared automatic-update links: in
sql-statements/sql-statement-flush-stats-delta.md lines 10-10, change the label
from 自动修改 to 自动更新 and target /statistics.md#自动更新; in statistics.md lines 19-19,
update the self-reference target to /statistics.md#自动更新.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e78484c2-a88f-4f97-be6c-40836ad12543
📒 Files selected for processing (5)
TOC.mdreleases/release-8.5.7.mdsql-statements/sql-statement-flush-stats-delta.mdsql-statements/sql-statement-overview.mdstatistics.md
|
/cc @0xPoe |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 87b103ec-0e2f-4287-819d-0eb2bf9bfbed
📒 Files selected for processing (1)
sql-statements/sql-statement-flush-stats-delta.md
| Query OK, 0 rows affected (0.01 sec) | ||
| ``` | ||
|
|
||
| 此时,TiDB 已将该表的行数变化持久化到 `mysql.stats_meta` 系统表。你可以使用 `SHOW STATS_META` 查看已持久化的值。注意,`SHOW STATS_META` 会从你当前连接的 TiDB 节点内存中读取统计信息。该 TiDB 节点会在 [`stats-lease`](/tidb-configuration-file.md#stats-lease)(默认 `3s`)周期内加载已持久化的值,因此刷新后的值可能会在短暂延迟后才显示在输出中: |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
补充 stats-lease=0 的边界行为
当前表述暗示刷新后的值最多延迟一个 stats-lease 周期即可显示,但当 stats-lease=0 时不会自动加载更新的统计信息;用户执行 FLUSH STATS_DELTA 后仍可能看到旧值,需要显式执行 REFRESH STATS。(docs.pingcap.com)
As per path instructions,Markdown 文档中的可安全连续修复应提供精确替换文本。
建议直接替换
-注意,`SHOW STATS_META` 会从你当前连接的 TiDB 节点内存中读取统计信息。该 TiDB 节点会在 [`stats-lease`](/tidb-configuration-file.md#stats-lease)(默认 `3s`)周期内加载已持久化的值,因此刷新后的值可能会在短暂延迟后才显示在输出中:
+注意,`SHOW STATS_META` 会从你当前连接的 TiDB 节点内存中读取统计信息。该 TiDB 节点会在 [`stats-lease`](/tidb-configuration-file.md#stats-lease)(默认 `3s`)周期内加载已持久化的值;当 `stats-lease` 设置为 `0` 时不会自动加载。此时,如需让内存中的统计信息反映刚持久化的值,请执行 [`REFRESH STATS`](/sql-statements/sql-statement-refresh-stats.md)。因此,刷新后的值可能会在短暂延迟后显示,或在 `stats-lease=0` 时不会自动显示:📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 此时,TiDB 已将该表的行数变化持久化到 `mysql.stats_meta` 系统表。你可以使用 `SHOW STATS_META` 查看已持久化的值。注意,`SHOW STATS_META` 会从你当前连接的 TiDB 节点内存中读取统计信息。该 TiDB 节点会在 [`stats-lease`](/tidb-configuration-file.md#stats-lease)(默认 `3s`)周期内加载已持久化的值,因此刷新后的值可能会在短暂延迟后才显示在输出中: | |
| 此时,TiDB 已将该表的行数变化持久化到 `mysql.stats_meta` 系统表。你可以使用 `SHOW STATS_META` 查看已持久化的值。注意,`SHOW STATS_META` 会从你当前连接的 TiDB 节点内存中读取统计信息。该 TiDB 节点会在 [`stats-lease`](/tidb-configuration-file.md#stats-lease)(默认 `3s`)周期内加载已持久化的值;当 `stats-lease` 设置为 `0` 时不会自动加载。此时,如需让内存中的统计信息反映刚持久化的值,请执行 [`REFRESH STATS`](/sql-statements/sql-statement-refresh-stats.md)。因此,刷新后的值可能会在短暂延迟后显示,或在 `stats-lease=0` 时不会自动显示: |
Source: Path instructions
What is changed, added or deleted? (Required)
Add documentation for the
FLUSH STATS_DELTAstatement introduced in v8.5.7 and v9.0.0 (pingcap/tidb#65668), which persists the pending statistics delta buffered in TiDB memory to themysql.stats_metasystem table immediately.sql-statements/sql-statement-flush-stats-delta.md(synopsis, options, examples, privileges).TOC.mdandsql-statements/sql-statement-overview.md.statistics.md.All examples and behavior descriptions (target scopes,
CLUSTERbroadcast, privilege requirements, and warnings) are verified against a TiDB v8.5.7 TiUP playground with two TiDB instances.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)?
flush stats_deltasyntax for optimizer statistics tidb#65677, planner, executor, parser: implement scoped FLUSH STATS_DELTA tidb#67766, planner, executor, parser: support scoped FLUSH STATS_DELTA tidb#68159Do your changes match any of the following descriptions?
Summary by CodeRabbit
FLUSH STATS_DELTA语句文档,补充语法、Targets、可选CLUSTER行为、去重规则、分区表处理、告警与跳过情形、所需SELECT权限、示例及兼容性说明。