Skip to content

Commit

Permalink
statistics: fix wrong behavior for primary key' init stats
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <[email protected]>
  • Loading branch information
hawkingrei committed May 15, 2024
1 parent ae1dfbe commit 26a5cd8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/statistics/handle/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,11 +751,8 @@ func (h *Handle) InitStats(is infoschema.InfoSchema) (err error) {
for _, table := range cache.Values() {
for _, col := range table.Columns {
if col.StatsAvailable() {
if mysql.HasPriKeyFlag(col.Info.GetFlag()) {
col.StatsLoadedStatus = statistics.NewStatsFullLoadStatus()
} else {
col.StatsLoadedStatus = statistics.NewStatsAllEvictedStatus()
}
// primary key column has no stats info, because primary key's is_index is false. so it cannot load the topn
col.StatsLoadedStatus = statistics.NewStatsAllEvictedStatus()
}
}
}
Expand Down

0 comments on commit 26a5cd8

Please sign in to comment.