@@ -83,7 +83,7 @@ func statsMetaCountAndModifyCount(
83
83
}
84
84
85
85
// HistMetaFromStorageWithHighPriority reads the meta info of the histogram from the storage.
86
- func HistMetaFromStorageWithHighPriority (sctx sessionctx.Context , item * model.TableItemID , possibleColInfo * model.ColumnInfo ) (* statistics.Histogram , * types. Datum , int64 , error ) {
86
+ func HistMetaFromStorageWithHighPriority (sctx sessionctx.Context , item * model.TableItemID , possibleColInfo * model.ColumnInfo ) (* statistics.Histogram , int64 , error ) {
87
87
isIndex := 0
88
88
var tp * types.FieldType
89
89
if item .IsIndex {
@@ -93,21 +93,20 @@ func HistMetaFromStorageWithHighPriority(sctx sessionctx.Context, item *model.Ta
93
93
tp = & possibleColInfo .FieldType
94
94
}
95
95
rows , _ , err := util .ExecRows (sctx ,
96
- "select high_priority distinct_count, version, null_count, tot_col_size, stats_ver, correlation, last_analyze_pos from mysql.stats_histograms where table_id = %? and hist_id = %? and is_index = %?" ,
96
+ "select high_priority distinct_count, version, null_count, tot_col_size, stats_ver, correlation from mysql.stats_histograms where table_id = %? and hist_id = %? and is_index = %?" ,
97
97
item .TableID ,
98
98
item .ID ,
99
99
isIndex ,
100
100
)
101
101
if err != nil {
102
- return nil , nil , 0 , err
102
+ return nil , 0 , err
103
103
}
104
104
if len (rows ) == 0 {
105
- return nil , nil , 0 , nil
105
+ return nil , 0 , nil
106
106
}
107
107
hist := statistics .NewHistogram (item .ID , rows [0 ].GetInt64 (0 ), rows [0 ].GetInt64 (2 ), rows [0 ].GetUint64 (1 ), tp , chunk .InitialCapacity , rows [0 ].GetInt64 (3 ))
108
108
hist .Correlation = rows [0 ].GetFloat64 (5 )
109
- lastPos := rows [0 ].GetDatum (6 , types .NewFieldType (mysql .TypeBlob ))
110
- return hist , & lastPos , rows [0 ].GetInt64 (4 ), nil
109
+ return hist , rows [0 ].GetInt64 (4 ), nil
111
110
}
112
111
113
112
// HistogramFromStorageWithPriority wraps the HistogramFromStorage with the given kv.Priority.
@@ -305,7 +304,6 @@ func indexStatsFromStorage(sctx sessionctx.Context, row chunk.Row, table *statis
305
304
nullCount := row .GetInt64 (5 )
306
305
statsVer := row .GetInt64 (7 )
307
306
idx := table .GetIdx (histID )
308
- lastAnalyzePos := row .GetDatum (9 , types .NewFieldType (mysql .TypeBlob ))
309
307
310
308
for _ , idxInfo := range tableInfo .Indices {
311
309
if histID != idxInfo .ID {
@@ -341,7 +339,6 @@ func indexStatsFromStorage(sctx sessionctx.Context, row chunk.Row, table *statis
341
339
if idx .IsAnalyzed () {
342
340
idx .StatsLoadedStatus = statistics .NewStatsAllEvictedStatus ()
343
341
}
344
- lastAnalyzePos .Copy (& idx .LastAnalyzePos )
345
342
break
346
343
}
347
344
if idx == nil || idx .LastUpdateVersion < histVer || loadAll {
@@ -374,7 +371,6 @@ func indexStatsFromStorage(sctx sessionctx.Context, row chunk.Row, table *statis
374
371
if statsVer != statistics .Version0 {
375
372
idx .StatsLoadedStatus = statistics .NewStatsFullLoadStatus ()
376
373
}
377
- lastAnalyzePos .Copy (& idx .LastAnalyzePos )
378
374
}
379
375
break
380
376
}
@@ -397,7 +393,6 @@ func columnStatsFromStorage(sctx sessionctx.Context, row chunk.Row, table *stati
397
393
totColSize := row .GetInt64 (6 )
398
394
statsVer := row .GetInt64 (7 )
399
395
correlation := row .GetFloat64 (8 )
400
- lastAnalyzePos := row .GetDatum (9 , types .NewFieldType (mysql .TypeBlob ))
401
396
col := table .GetCol (histID )
402
397
403
398
for _ , colInfo := range tableInfo .Columns {
@@ -447,7 +442,6 @@ func columnStatsFromStorage(sctx sessionctx.Context, row chunk.Row, table *stati
447
442
if col .StatsAvailable () {
448
443
col .StatsLoadedStatus = statistics .NewStatsAllEvictedStatus ()
449
444
}
450
- lastAnalyzePos .Copy (& col .LastAnalyzePos )
451
445
col .Histogram .Correlation = correlation
452
446
break
453
447
}
@@ -482,7 +476,6 @@ func columnStatsFromStorage(sctx sessionctx.Context, row chunk.Row, table *stati
482
476
if col .StatsAvailable () {
483
477
col .StatsLoadedStatus = statistics .NewStatsFullLoadStatus ()
484
478
}
485
- lastAnalyzePos .Copy (& col .LastAnalyzePos )
486
479
break
487
480
}
488
481
if col .TotColSize != totColSize {
@@ -532,7 +525,7 @@ func TableStatsFromStorage(sctx sessionctx.Context, snapshot uint64, tableInfo *
532
525
table .ModifyCount = modidyCount
533
526
table .RealtimeCount = realtimeCount
534
527
535
- rows , _ , err := util .ExecRows (sctx , "select table_id, is_index, hist_id, distinct_count, version, null_count, tot_col_size, stats_ver, correlation, last_analyze_pos from mysql.stats_histograms where table_id = %?" , tableID )
528
+ rows , _ , err := util .ExecRows (sctx , "select table_id, is_index, hist_id, distinct_count, version, null_count, tot_col_size, stats_ver, correlation from mysql.stats_histograms where table_id = %?" , tableID )
536
529
if err != nil {
537
530
return nil , err
538
531
}
@@ -559,7 +552,7 @@ func TableStatsFromStorage(sctx sessionctx.Context, snapshot uint64, tableInfo *
559
552
560
553
// LoadHistogram will load histogram from storage.
561
554
func LoadHistogram (sctx sessionctx.Context , tableID int64 , isIndex int , histID int64 , tableInfo * model.TableInfo ) (* statistics.Histogram , error ) {
562
- row , _ , err := util .ExecRows (sctx , "select distinct_count, version, null_count, tot_col_size, stats_ver, flag, correlation, last_analyze_pos from mysql.stats_histograms where table_id = %? and is_index = %? and hist_id = %?" , tableID , isIndex , histID )
555
+ row , _ , err := util .ExecRows (sctx , "select distinct_count, version, null_count, tot_col_size, stats_ver, flag, correlation from mysql.stats_histograms where table_id = %? and is_index = %? and hist_id = %?" , tableID , isIndex , histID )
563
556
if err != nil || len (row ) == 0 {
564
557
return nil , err
565
558
}
@@ -664,7 +657,7 @@ func loadNeededColumnHistograms(sctx sessionctx.Context, statsHandle statstypes.
664
657
return nil
665
658
}
666
659
667
- hg , _ , statsVer , err := HistMetaFromStorageWithHighPriority (sctx , & col , colInfo )
660
+ hg , statsVer , err := HistMetaFromStorageWithHighPriority (sctx , & col , colInfo )
668
661
if hg == nil || err != nil {
669
662
asyncload .AsyncLoadHistogramNeededItems .Delete (col )
670
663
return err
@@ -743,7 +736,7 @@ func loadNeededIndexHistograms(sctx sessionctx.Context, is infoschema.InfoSchema
743
736
asyncload .AsyncLoadHistogramNeededItems .Delete (idx )
744
737
return nil
745
738
}
746
- hgMeta , lastAnalyzePos , statsVer , err := HistMetaFromStorageWithHighPriority (sctx , & idx , nil )
739
+ hgMeta , statsVer , err := HistMetaFromStorageWithHighPriority (sctx , & idx , nil )
747
740
if hgMeta == nil || err != nil {
748
741
asyncload .AsyncLoadHistogramNeededItems .Delete (idx )
749
742
return err
@@ -772,7 +765,6 @@ func loadNeededIndexHistograms(sctx sessionctx.Context, is infoschema.InfoSchema
772
765
Info : idxInfo , StatsVer : statsVer ,
773
766
PhysicalID : idx .TableID ,
774
767
StatsLoadedStatus : statistics .NewStatsFullLoadStatus ()}
775
- lastAnalyzePos .Copy (& idxHist .LastAnalyzePos )
776
768
777
769
tbl , ok = statsHandle .Get (idx .TableID )
778
770
if ! ok {
0 commit comments