diff --git a/pkg/statistics/handle/bootstrap.go b/pkg/statistics/handle/bootstrap.go index 9d17316ef042b..4b11e3c7c0730 100644 --- a/pkg/statistics/handle/bootstrap.go +++ b/pkg/statistics/handle/bootstrap.go @@ -73,7 +73,6 @@ func (h *Handle) initStatsMeta4Chunk(is infoschema.InfoSchema, cache statstypes. tbl := &statistics.Table{ HistColl: newHistColl, Version: row.GetUint64(0), - Name: util.GetFullTableName(is, tableInfo), ColAndIdxExistenceMap: statistics.NewColAndIndexExistenceMap(len(tableInfo.Columns), len(tableInfo.Indices)), IsPkIsHandle: tableInfo.PKIsHandle, } diff --git a/pkg/statistics/handle/cache/statscache.go b/pkg/statistics/handle/cache/statscache.go index b8a1b1e993571..0425ae647cd31 100644 --- a/pkg/statistics/handle/cache/statscache.go +++ b/pkg/statistics/handle/cache/statscache.go @@ -127,7 +127,6 @@ func (s *StatsCacheImpl) Update(is infoschema.InfoSchema) error { tbl.Version = version tbl.RealtimeCount = count tbl.ModifyCount = modifyCount - tbl.Name = util.GetFullTableName(is, tableInfo) tbl.TblInfoUpdateTS = tableInfo.UpdateTS tables = append(tables, tbl) } diff --git a/pkg/statistics/handle/util/util.go b/pkg/statistics/handle/util/util.go index 411242d8de0cc..f54deffae46a7 100644 --- a/pkg/statistics/handle/util/util.go +++ b/pkg/statistics/handle/util/util.go @@ -20,10 +20,8 @@ import ( "time" "github.com/pingcap/errors" - "github.com/pingcap/tidb/pkg/infoschema" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/parser/ast" - "github.com/pingcap/tidb/pkg/parser/model" "github.com/pingcap/tidb/pkg/parser/terror" "github.com/pingcap/tidb/pkg/sessionctx" "github.com/pingcap/tidb/pkg/sessionctx/variable" @@ -226,18 +224,6 @@ func DurationToTS(d time.Duration) uint64 { return oracle.ComposeTS(d.Nanoseconds()/int64(time.Millisecond), 0) } -// GetFullTableName returns the full table name. -func GetFullTableName(is infoschema.InfoSchema, tblInfo *model.TableInfo) string { - for _, schemaName := range is.AllSchemaNames() { - if t, err := is.TableByName(schemaName, tblInfo.Name); err == nil { - if t.Meta().ID == tblInfo.ID { - return schemaName.O + "." + tblInfo.Name.O - } - } - } - return strconv.FormatInt(tblInfo.ID, 10) -} - // JSONTable is used for dumping statistics. type JSONTable struct { Columns map[string]*JSONColumn `json:"columns"` diff --git a/pkg/statistics/table.go b/pkg/statistics/table.go index 603da81529e4a..f954dc98c7057 100644 --- a/pkg/statistics/table.go +++ b/pkg/statistics/table.go @@ -61,7 +61,6 @@ type Table struct { ExtendedStats *ExtendedStatsColl ColAndIdxExistenceMap *ColAndIdxExistenceMap - Name string HistColl Version uint64 // It's the timestamp of the last analyze time. @@ -427,7 +426,6 @@ func (t *Table) Copy() *Table { nt := &Table{ HistColl: newHistColl, Version: t.Version, - Name: t.Name, TblInfoUpdateTS: t.TblInfoUpdateTS, IsPkIsHandle: t.IsPkIsHandle, LastAnalyzeVersion: t.LastAnalyzeVersion, @@ -465,7 +463,6 @@ func (t *Table) ShallowCopy() *Table { nt := &Table{ HistColl: newHistColl, Version: t.Version, - Name: t.Name, TblInfoUpdateTS: t.TblInfoUpdateTS, ExtendedStats: t.ExtendedStats, ColAndIdxExistenceMap: t.ColAndIdxExistenceMap,