File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -571,11 +571,18 @@ func (e *AnalyzeColumnsExecV2) buildSubIndexJobForSpecialIndex(indexInfos []*mod
571
571
_ , offset := timeutil .Zone (e .ctx .GetSessionVars ().Location ())
572
572
tasks := make ([]* analyzeTask , 0 , len (indexInfos ))
573
573
sc := e .ctx .GetSessionVars ().StmtCtx
574
+ var concurrency int
575
+ if e .ctx .GetSessionVars ().InRestrictedSQL {
576
+ // In restricted SQL, we use the default value of IndexSerialScanConcurrency. it is copied from tidb_sysproc_scan_concurrency.
577
+ concurrency = e .ctx .GetSessionVars ().IndexSerialScanConcurrency ()
578
+ } else {
579
+ concurrency = e .ctx .GetSessionVars ().AnalyzeDistSQLScanConcurrency ()
580
+ }
574
581
for _ , indexInfo := range indexInfos {
575
582
base := baseAnalyzeExec {
576
583
ctx : e .ctx ,
577
584
tableID : e .TableID ,
578
- concurrency : e . ctx . GetSessionVars (). IndexSerialScanConcurrency () ,
585
+ concurrency : concurrency ,
579
586
analyzePB : & tipb.AnalyzeReq {
580
587
Tp : tipb .AnalyzeType_TypeIndex ,
581
588
Flags : sc .PushDownFlags (),
Original file line number Diff line number Diff line change @@ -2559,11 +2559,17 @@ func (b *executorBuilder) buildAnalyzeIndexPushdown(task plannercore.AnalyzeInde
2559
2559
failpoint .Inject ("injectAnalyzeSnapshot" , func (val failpoint.Value ) {
2560
2560
startTS = uint64 (val .(int ))
2561
2561
})
2562
-
2562
+ var concurrency int
2563
+ if b .ctx .GetSessionVars ().InRestrictedSQL {
2564
+ // In restricted SQL, we use the default value of IndexSerialScanConcurrency. it is copied from tidb_sysproc_scan_concurrency.
2565
+ concurrency = b .ctx .GetSessionVars ().IndexSerialScanConcurrency ()
2566
+ } else {
2567
+ concurrency = b .ctx .GetSessionVars ().AnalyzeDistSQLScanConcurrency ()
2568
+ }
2563
2569
base := baseAnalyzeExec {
2564
2570
ctx : b .ctx ,
2565
2571
tableID : task .TableID ,
2566
- concurrency : b . ctx . GetSessionVars (). IndexSerialScanConcurrency () ,
2572
+ concurrency : concurrency ,
2567
2573
analyzePB : & tipb.AnalyzeReq {
2568
2574
Tp : tipb .AnalyzeType_TypeIndex ,
2569
2575
Flags : sc .PushDownFlags (),
You can’t perform that action at this time.
0 commit comments