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 |
📝 WalkthroughWalkthroughAdds Chinese documentation for ChangesFLUSH STATS_DELTA documentation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Poem
🚥 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
|
|
||
| `FLUSH STATS_DELTA` 会立即将 TiDB 内存中缓冲的待持久化统计信息 delta 持久化到 [`mysql.stats_meta`](/mysql-schema/mysql-schema.md#statistics-system-tables) 系统表中。 | ||
|
|
||
| 当你使用 DML 语句(例如 `INSERT`、`UPDATE` 和 `DELETE`)修改数据时,TiDB 会记录每个受影响表的总行数和已修改行数的变化,将这些变化(称为 statistics delta)缓存在执行这些语句的 TiDB 节点内存中,并每隔 20 * [`stats-lease`](/tidb-configuration-file.md#stats-lease)(默认 60 秒)将其持久化到 `mysql.stats_meta` 系统表中。更多信息,参见[自动修改](/statistics.md#automatic-update)。 |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Correct the shared automatic-update anchor.
Both links target #automatic-update, while the supplied Chinese heading is ### 自动更新; the new statement page also uses the inaccurate label 自动修改.
sql-statements/sql-statement-flush-stats-delta.md#L10-L10: change the label to自动更新and target/statistics.md#自动更新.statistics.md#L19-L19: change the self-reference target to/statistics.md#自动更新.
📍 Affects 2 files
sql-statements/sql-statement-flush-stats-delta.md#L10-L10(this comment)statistics.md#L19-L19
🤖 Prompt for 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.
In `@sql-statements/sql-statement-flush-stats-delta.md` at 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#自动更新.
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_DELTAstatement, including syntax, targets, permissions, examples, and behavior.FLUSH STATS_DELTAto the SQL statement reference and statistics management documentation.