File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
pkg/statistics/handle/syncload Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ go_library(
14
14
"//pkg/parser/mysql" ,
15
15
"//pkg/sessionctx" ,
16
16
"//pkg/sessionctx/stmtctx" ,
17
+ "//pkg/sessionctx/variable" ,
17
18
"//pkg/statistics" ,
18
19
"//pkg/statistics/handle/storage" ,
19
20
"//pkg/statistics/handle/types" ,
Original file line number Diff line number Diff line change @@ -307,11 +307,14 @@ func (s *statsSyncLoad) handleOneItemTask(task *statstypes.NeededItemTask) (err
307
307
s .statsHandle .SPool ().Destroy (se )
308
308
}
309
309
}()
310
+ var skipTypes map [string ]struct {}
310
311
val , err := sctx .GetSessionVars ().GlobalVarsAccessor .GetGlobalSysVar (variable .TiDBAnalyzeSkipColumnTypes )
311
312
if err != nil {
312
313
logutil .BgLogger ().Warn ("failed to get global variable" , zap .Error (err ))
314
+ } else {
315
+ skipTypes = variable .ParseAnalyzeSkipColumnTypes (val )
313
316
}
314
- skipTypes := variable . ParseAnalyzeSkipColumnTypes ( val )
317
+
315
318
item := task .Item .TableItemID
316
319
statsTbl , ok := s .statsHandle .Get (item .TableID )
317
320
@@ -348,10 +351,13 @@ func (s *statsSyncLoad) handleOneItemTask(task *statstypes.NeededItemTask) (err
348
351
// so we have to get the column info from the domain.
349
352
wrapper .colInfo = tblInfo .GetColumnByID (item .ID )
350
353
}
351
- _ , skip := skipTypes [types .TypeToStr (wrapper .colInfo .FieldType .GetType (), wrapper .colInfo .FieldType .GetCharset ())]
352
- if skip {
353
- return nil
354
+ if skipTypes != nil {
355
+ _ , skip := skipTypes [types .TypeToStr (wrapper .colInfo .FieldType .GetType (), wrapper .colInfo .FieldType .GetCharset ())]
356
+ if skip {
357
+ return nil
358
+ }
354
359
}
360
+
355
361
// If this column is not analyzed yet and we don't have it in memory.
356
362
// We create a fake one for the pseudo estimation.
357
363
// Otherwise, it will trigger the sync/async load again, even if the column has not been analyzed.
You can’t perform that action at this time.
0 commit comments