From 210237b8d9e433915af70b7571a580a24de927c6 Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Mon, 26 Dec 2022 15:19:35 +0800 Subject: [PATCH] don't reset concurrency of analyze req to 2 --- store/copr/coprocessor.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/store/copr/coprocessor.go b/store/copr/coprocessor.go index 390c5ffe8e63a..94a2f478290a8 100644 --- a/store/copr/coprocessor.go +++ b/store/copr/coprocessor.go @@ -213,7 +213,8 @@ func (c *CopClient) BuildCopIterator(ctx context.Context, req *kv.Request, vars // higher concurrency, the data is just cached and not consumed for a while, this increase the memory usage. // Set concurrency to 2 can reduce the memory usage and I've tested that it does not necessarily // decrease the performance. - if it.concurrency > 2 { + // For ReqTypeAnalyze, we keep its concurrency to avoid slow analyze(see https://github.com/pingcap/tidb/issues/40162 for details). + if it.concurrency > 2 && it.req.Tp != kv.ReqTypeAnalyze { oldConcurrency := it.concurrency it.concurrency = 2