diff --git a/pkg/planner/core/planbuilder.go b/pkg/planner/core/planbuilder.go index 2fb3595c0e..3fda1ff0a1 100644 --- a/pkg/planner/core/planbuilder.go +++ b/pkg/planner/core/planbuilder.go @@ -2440,18 +2440,9 @@ func getModifiedIndexesInfoForAnalyze( // filterSkipColumnTypes filters out columns whose types are in the skipTypes list. func (b *PlanBuilder) filterSkipColumnTypes(origin []*model.ColumnInfo, tbl *resolve.TableNameW, mustAnalyzedCols *calcOnceMap) (result []*model.ColumnInfo, skipCol []*model.ColumnInfo) { - // If the session is in restricted SQL mode, it uses @@global.tidb_analyze_skip_column_types to get the skipTypes list. + // For auto-analyze, it uses @@global.tidb_analyze_skip_column_types to obtain the skipTypes list. + // This is already handled before executing the query by the CallWithSCtx utility function. skipTypes := b.ctx.GetSessionVars().AnalyzeSkipColumnTypes - if b.ctx.GetSessionVars().InRestrictedSQL { - // For auto analyze, we need to use @@global.tidb_analyze_skip_column_types. - val, err1 := b.ctx.GetSessionVars().GlobalVarsAccessor.GetGlobalSysVar(vardef.TiDBAnalyzeSkipColumnTypes) - if err1 != nil { - logutil.BgLogger().Error("loading tidb_analyze_skip_column_types failed", zap.Error(err1)) - result = origin - return - } - skipTypes = variable.ParseAnalyzeSkipColumnTypes(val) - } mustAnalyze, err1 := b.getMustAnalyzedColumns(tbl, mustAnalyzedCols) if err1 != nil { logutil.BgLogger().Error("getting must-analyzed columns failed", zap.Error(err1))