diff --git a/statistics/index.go b/statistics/index.go index d201aa8fdd14f..40ba2b005843b 100644 --- a/statistics/index.go +++ b/statistics/index.go @@ -298,7 +298,7 @@ func (idx *Index) GetRowCount(sctx sessionctx.Context, coll *HistColl, indexRang if expBackoffCnt > upperLimit { expBackoffCnt = upperLimit } - totalCount += expBackoffCnt + count += expBackoffCnt } } if !expBackoffSuccess { @@ -310,7 +310,7 @@ func (idx *Index) GetRowCount(sctx sessionctx.Context, coll *HistColl, indexRang // handling the out-of-range part if (idx.outOfRange(l) && !(isSingleCol && lowIsNull)) || idx.outOfRange(r) { - totalCount += idx.Histogram.outOfRangeRowCount(&l, &r, modifyCount) + count += idx.Histogram.outOfRangeRowCount(&l, &r, modifyCount) } totalCount += count }