-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
statistics: do not analyze table when auto analyze ratio is 0 #51467
statistics: do not analyze table when auto analyze ratio is 0 #51467
Conversation
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #51467 +/- ##
================================================
+ Coverage 70.7288% 72.8187% +2.0899%
================================================
Files 1462 1462
Lines 435268 435293 +25
================================================
+ Hits 307860 316975 +9115
+ Misses 108130 98376 -9754
- Partials 19278 19942 +664
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔢 Self-check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, elsa0520 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What problem does this PR solve?
Issue Number: ref #50132
Problem Summary:
What changed and how does it work?
There are two configurations for the auto-analyze feature that are very easy to misunderstand.
tidb_enable_auto_analyze
: Determines whether TiDB automatically updates table statistics as a background operation.tidb_auto_analyze_ratio
: This variable is used to set the threshold when TiDB automatically executes ANALYZE TABLE in a background thread to update table statistics. It is possible for the value to be 0, which means auto analysis based on the change percentage will be turned off. However, new tables and indexes will still be analyzed.So in the new implementation, I forgot it.
In this PR, I added a check for auto-analyze ratio and also added a test case to cover it.
Off-topic: I also updated
TestPickOneTableAndAnalyzeByPriority
to use the real API to do the analysis instead of inserting jobs directly.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.