Skip to content

statistics: add docs for the FLUSH STATS_DELTA statement#23258

Open
0xPoe wants to merge 2 commits into
pingcap:masterfrom
0xPoe:add-flush-stats-delta-doc
Open

statistics: add docs for the FLUSH STATS_DELTA statement#23258
0xPoe wants to merge 2 commits into
pingcap:masterfrom
0xPoe:add-flush-stats-delta-doc

Conversation

@0xPoe

@0xPoe 0xPoe commented Jul 13, 2026

Copy link
Copy Markdown
Member

What is changed, added or deleted? (Required)

Add documentation for the FLUSH STATS_DELTA statement introduced in v8.5.7 and v9.0.0 (pingcap/tidb#65668), which persists the pending statistics delta buffered in TiDB memory to the mysql.stats_meta system table immediately.

  • Add a new page: sql-statements/sql-statement-flush-stats-delta.md (synopsis, options, examples, privileges).
  • Add the statement to TOC.md and sql-statements/sql-statement-overview.md.
  • Cross-link the statement from the "Automatic update" section in statistics.md.

All examples and behavior descriptions (target scopes, CLUSTER broadcast, 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.

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)

What is the related PR or file link(s)?

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@ti-chi-bot

ti-chi-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign lilin90 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@0xPoe 0xPoe added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Jul 13, 2026
@ti-chi-bot ti-chi-bot Bot added missing-translation-status This PR does not have translation status info. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 13, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request documents the new FLUSH STATS_DELTA SQL statement, which immediately persists pending statistics delta from TiDB memory to the mysql.stats_meta system table. The changes include a new dedicated documentation file, updates to the table of contents, the SQL statements overview, and the statistics guide. The review feedback is highly constructive, focusing on improving clarity, readability, and style guide compliance by replacing passive voice with active voice, using the second person ('you'), and capitalizing list item descriptions.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread sql-statements/sql-statement-flush-stats-delta.md Outdated
Comment thread sql-statements/sql-statement-flush-stats-delta.md Outdated
Comment thread sql-statements/sql-statement-flush-stats-delta.md Outdated
Comment thread sql-statements/sql-statement-flush-stats-delta.md
Comment thread sql-statements/sql-statement-flush-stats-delta.md Outdated
@qiancai qiancai self-assigned this Jul 14, 2026
@qiancai qiancai added v9.0-beta.3 This PR/issue applies to TiDB v9.0-beta.3. translation/doing This PR's assignee is translating this PR. labels Jul 14, 2026
@ti-chi-bot ti-chi-bot Bot removed the missing-translation-status This PR does not have translation status info. label Jul 14, 2026

@0xPoe 0xPoe left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔢 Self-check (PR reviewed by myself and ready for feedback)

/cc @winoros

@ti-chi-bot ti-chi-bot Bot requested a review from winoros July 14, 2026 10:08

@winoros winoros left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no other comments


# FLUSH STATS_DELTA

`FLUSH STATS_DELTA` persists the pending statistics delta buffered in TiDB memory to the [`mysql.stats_meta`](/mysql-schema/mysql-schema.md#statistics-system-tables) system table immediately. TiDB supports this statement starting from v8.5.7 and v9.0.0.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the statement v9.0.0 needs a check from doc steam.

@ti-chi-bot

ti-chi-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

@winoros: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

no other comments

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@terry1purcell

Copy link
Copy Markdown
Contributor

/hold

@ti-chi-bot ti-chi-bot Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 14, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

@terry1purcell: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. translation/doing This PR's assignee is translating this PR. v9.0-beta.3 This PR/issue applies to TiDB v9.0-beta.3.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants