-
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
statistics: trigger auto-analyze based on histogram row count #24382
Changes from 7 commits
14cb4a7
959aa3d
380c353
728f7b9
631ac2e
9d3918b
6664135
090817c
753089a
d8e66ad
5ace68e
1d83683
5472c8f
851e136
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,6 +214,16 @@ func (t *Table) GetStatsInfo(ID int64, isIndex bool) (int64, *Histogram, *CMSket | |
return int64(colStatsInfo.TotalRowCount()), colStatsInfo.Histogram.Copy(), colStatsInfo.CMSketch.Copy(), colStatsInfo.TopN.Copy(), colStatsInfo.FMSketch.Copy() | ||
} | ||
|
||
// ColHistCount returns the count of the column histograms. | ||
func (t *Table) ColHistCount() float64 { | ||
for _, col := range t.Columns { | ||
if col != nil { | ||
Comment on lines
+218
to
+220
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need to check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we only try to get row count from columns? I think indexes are also useful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. 👌 There is one special case. When the stats for a column is not loaded and there are NULLs in this column, the |
||
return col.TotalRowCount() | ||
} | ||
} | ||
return -1 | ||
} | ||
|
||
type tableColumnID struct { | ||
TableID int64 | ||
ColumnID int64 | ||
|
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.
The name could be changed since the topn is split out of the histogram.