-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
parser: allow drop stats of multiple tables #38042
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
My short answer: Only allow I have a patch for always enabling GLOBAL stats for partitioned tables here, which I also see as a part of this discussion :) Due to the plans of removing static partition prune mode, I would prefer that we also deprecating the support of partition specific configuration of statistics, and not adding support of dropping stats for a specific partition. Unless there are plans to change the statistic usage for partitioned tables under dynamic prune mode? I propose that we only support ANALYZE table (global) with non-default configuration (like buckets, samples etc.) and only saves the configuration on table/global level. My reasoning is that the partition level statistics is aggregated to table/global level and should not differ in configuration which may result in issues when calculating the table/global statistic. Meaning the following syntax should be supported: And this would be deprecated: |
executor/simple.go
Outdated
@@ -1670,15 +1670,14 @@ func (e *SimpleExec) executeAlterInstance(s *ast.AlterInstanceStmt) error { | |||
func (e *SimpleExec) executeDropStats(s *ast.DropStatsStmt) (err error) { | |||
h := domain.GetDomain(e.ctx).StatsHandle() | |||
var statsIDs []int64 | |||
if s.IsGlobalStats { | |||
statsIDs = []int64{s.Table.TableInfo.ID} | |||
if s.IsGlobalStats || len(s.PartitionNames) == 0 { |
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.
If my proposal that we only support GLOBAL/per table DROP STATS, then I think this should always be done.
37e3413
to
356b6f7
Compare
@mjonss Good answer! IIUC,
PTAL |
962ea79
to
d313663
Compare
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, just a minor suggestion on comment change.
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.
@YangKeao Rebase please. Also, don't forget pingcap/doc changes.
@YangKeao rebase please, let us merge it. |
Signed-off-by: YangKeao <yangkeao@chunibyo.icu>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: bebee8b
|
I have updated the documents in pingcap/docs-cn#11986 and pingcap/docs#11287. Could you please tech-review these documents? @mjonss @xhebox . I only update the syntax (following the |
TiDB MergeCI notify🔴 Bad News! New failing [1] after this pr merged.
|
Signed-off-by: YangKeao yangkeao@chunibyo.icu
What problem does this PR solve?
Issue Number: close #37872
Problem Summary:
DROP STATS
doesn't allow dropping stats of multiple tables now.What is changed and how it works?
This PR modifies the parser and executors to allow dropping multiple tables without partitions.
The grammar should be discussed, as the
DROP STATS t1, t2 GLOBAL
andDROP STATS t PARTITION xxx
is not consistent now. I'm not sure whether it's expected, or I shouldn't allow dropping multiple tables withGLOBAL
at the end?Check List
Tests
Release note