Skip to content

Commit

Permalink
planner, stats: clean the called of Index.CheckStats (#46868)
Browse files Browse the repository at this point in the history
ref #46867
  • Loading branch information
winoros authored Sep 12, 2023
1 parent b7f0742 commit b7cada2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 3 deletions.
1 change: 0 additions & 1 deletion planner/cardinality/row_count_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ func isSingleColIdxNullRange(idx *statistics.Index, ran *ranger.Range) bool {

// It uses the modifyCount to adjust the influence of modifications on the table.
func getIndexRowCountForStatsV2(sctx sessionctx.Context, idx *statistics.Index, coll *statistics.HistColl, indexRanges []*ranger.Range, realtimeRowCount, modifyCount int64) (float64, error) {
idx.CheckStats()
sc := sctx.GetSessionVars().StmtCtx
debugTrace := sc.EnableOptimizerDebugTrace
if debugTrace {
Expand Down
2 changes: 0 additions & 2 deletions statistics/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ func (idx *Index) String() string {

// TotalRowCount returns the total count of this index.
func (idx *Index) TotalRowCount() float64 {
idx.CheckStats()
if idx.StatsVer >= Version2 {
return idx.Histogram.TotalRowCount() + float64(idx.TopN.TotalCount())
}
Expand Down Expand Up @@ -183,7 +182,6 @@ func (idx *Index) MemoryUsage() CacheItemMemoryUsage {
// QueryBytes is used to query the count of specified bytes.
// The input sctx is just for debug trace, you can pass nil safely if that's not needed.
func (idx *Index) QueryBytes(sctx sessionctx.Context, d []byte) (result uint64) {
idx.CheckStats()
if sctx != nil && sctx.GetSessionVars().StmtCtx.EnableOptimizerDebugTrace {
debugtrace.EnterContextCommon(sctx)
defer func() {
Expand Down

0 comments on commit b7cada2

Please sign in to comment.