Skip to content

Commit 6bf6755

Browse files
authored
statistics: remove useless GetFullTableName (#52552) (#52588)
close #52553
1 parent f471b0b commit 6bf6755

File tree

4 files changed

+0
-19
lines changed

4 files changed

+0
-19
lines changed

pkg/statistics/handle/bootstrap.go

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ func (h *Handle) initStatsMeta4Chunk(is infoschema.InfoSchema, cache statstypes.
7373
tbl := &statistics.Table{
7474
HistColl: newHistColl,
7575
Version: row.GetUint64(0),
76-
Name: util.GetFullTableName(is, tableInfo),
7776
ColAndIdxExistenceMap: statistics.NewColAndIndexExistenceMap(len(tableInfo.Columns), len(tableInfo.Indices)),
7877
IsPkIsHandle: tableInfo.PKIsHandle,
7978
}

pkg/statistics/handle/cache/statscache.go

-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ func (s *StatsCacheImpl) Update(is infoschema.InfoSchema) error {
127127
tbl.Version = version
128128
tbl.RealtimeCount = count
129129
tbl.ModifyCount = modifyCount
130-
tbl.Name = util.GetFullTableName(is, tableInfo)
131130
tbl.TblInfoUpdateTS = tableInfo.UpdateTS
132131
tables = append(tables, tbl)
133132
}

pkg/statistics/handle/util/util.go

-14
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ import (
2020
"time"
2121

2222
"github.com/pingcap/errors"
23-
"github.com/pingcap/tidb/pkg/infoschema"
2423
"github.com/pingcap/tidb/pkg/kv"
2524
"github.com/pingcap/tidb/pkg/parser/ast"
26-
"github.com/pingcap/tidb/pkg/parser/model"
2725
"github.com/pingcap/tidb/pkg/parser/terror"
2826
"github.com/pingcap/tidb/pkg/sessionctx"
2927
"github.com/pingcap/tidb/pkg/sessionctx/variable"
@@ -226,18 +224,6 @@ func DurationToTS(d time.Duration) uint64 {
226224
return oracle.ComposeTS(d.Nanoseconds()/int64(time.Millisecond), 0)
227225
}
228226

229-
// GetFullTableName returns the full table name.
230-
func GetFullTableName(is infoschema.InfoSchema, tblInfo *model.TableInfo) string {
231-
for _, schemaName := range is.AllSchemaNames() {
232-
if t, err := is.TableByName(schemaName, tblInfo.Name); err == nil {
233-
if t.Meta().ID == tblInfo.ID {
234-
return schemaName.O + "." + tblInfo.Name.O
235-
}
236-
}
237-
}
238-
return strconv.FormatInt(tblInfo.ID, 10)
239-
}
240-
241227
// JSONTable is used for dumping statistics.
242228
type JSONTable struct {
243229
Columns map[string]*JSONColumn `json:"columns"`

pkg/statistics/table.go

-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ type Table struct {
6161
ExtendedStats *ExtendedStatsColl
6262

6363
ColAndIdxExistenceMap *ColAndIdxExistenceMap
64-
Name string
6564
HistColl
6665
Version uint64
6766
// It's the timestamp of the last analyze time.
@@ -427,7 +426,6 @@ func (t *Table) Copy() *Table {
427426
nt := &Table{
428427
HistColl: newHistColl,
429428
Version: t.Version,
430-
Name: t.Name,
431429
TblInfoUpdateTS: t.TblInfoUpdateTS,
432430
IsPkIsHandle: t.IsPkIsHandle,
433431
LastAnalyzeVersion: t.LastAnalyzeVersion,
@@ -465,7 +463,6 @@ func (t *Table) ShallowCopy() *Table {
465463
nt := &Table{
466464
HistColl: newHistColl,
467465
Version: t.Version,
468-
Name: t.Name,
469466
TblInfoUpdateTS: t.TblInfoUpdateTS,
470467
ExtendedStats: t.ExtendedStats,
471468
ColAndIdxExistenceMap: t.ColAndIdxExistenceMap,

0 commit comments

Comments
 (0)