diff --git a/pkg/statistics/handle/storage/stats_read_writer.go b/pkg/statistics/handle/storage/stats_read_writer.go index 3d4d08ccaf975..03dbaa840fbae 100644 --- a/pkg/statistics/handle/storage/stats_read_writer.go +++ b/pkg/statistics/handle/storage/stats_read_writer.go @@ -652,7 +652,7 @@ func (s *statsReadWriter) loadStatsFromJSON(tableInfo *model.TableInfo, physical // loadStatsFromJSON doesn't support partition table now. // The table level count and modify_count would be overridden by the SaveMetaToStorage below, so we don't need // to care about them here. - err = s.SaveStatsToStorage(tbl.PhysicalID, tbl.RealtimeCount, 0, 0, &col.Histogram, col.CMSketch, col.TopN, int(col.GetStatsVer()), 1, false, util.StatsMetaHistorySourceLoadStats) + err = s.SaveStatsToStorage(tbl.PhysicalID, tbl.RealtimeCount, 0, 0, &col.Histogram, col.CMSketch, col.TopN, int(col.GetStatsVer()), statistics.AnalyzeFlag, false, util.StatsMetaHistorySourceLoadStats) if err != nil { return errors.Trace(err) } @@ -661,7 +661,7 @@ func (s *statsReadWriter) loadStatsFromJSON(tableInfo *model.TableInfo, physical // loadStatsFromJSON doesn't support partition table now. // The table level count and modify_count would be overridden by the SaveMetaToStorage below, so we don't need // to care about them here. - err = s.SaveStatsToStorage(tbl.PhysicalID, tbl.RealtimeCount, 0, 1, &idx.Histogram, idx.CMSketch, idx.TopN, int(idx.GetStatsVer()), 1, false, util.StatsMetaHistorySourceLoadStats) + err = s.SaveStatsToStorage(tbl.PhysicalID, tbl.RealtimeCount, 0, 1, &idx.Histogram, idx.CMSketch, idx.TopN, int(idx.GetStatsVer()), statistics.AnalyzeFlag, false, util.StatsMetaHistorySourceLoadStats) if err != nil { return errors.Trace(err) } diff --git a/pkg/statistics/histogram.go b/pkg/statistics/histogram.go index 14c0ce816def4..c69eb18f3c08a 100644 --- a/pkg/statistics/histogram.go +++ b/pkg/statistics/histogram.go @@ -261,11 +261,6 @@ const ( // AnalyzeFlag is set when the statistics comes from analyze. const AnalyzeFlag = 1 -// IsAnalyzed checks whether this flag contains AnalyzeFlag. -func IsAnalyzed(flag int64) bool { - return (flag & AnalyzeFlag) > 0 -} - // ValueToString converts a possible encoded value to a formatted string. If the value is encoded, then // idxCols equals to number of origin values, else idxCols is 0. func ValueToString(vars *variable.SessionVars, value *types.Datum, idxCols int, idxColumnTypes []byte) (string, error) {