Collecting statistics under dynamic partition pruning takes a long time and hangs during the globalstats merge

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 动态分区裁剪下收集统计信息在做globalstats合并的时候,耗时很久未完成,hang住了

| username: BraveChen

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Issue Phenomenon and Impact]
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots / Logs / Monitoring]

SQL Error: disable dynamic pruning due to t gm lon cont has no global stats

Then collect statistics: ANALYZE table ###;

It took a long time and did not complete, observed show analyze status;
Suspected to be hanging

| username: WalterWj | Original post link

Try increasing this: 系统变量 | PingCAP 文档中心

| username: BraveChen | Original post link

The default value is 1. Generally, what size is appropriate to adjust it to?

| username: WalterWj | Original post link

set session tidb_build_stats_concurrency=30;
set session tidb_distsql_scan_concurrency=30;
set session tidb_index_serial_scan_concurrency=2;
Try increasing these as well ANALYZE TABLE execution time depending on number of partitions · Issue #35142 · pingcap/tidb · GitHub This is the related issue.

How much is the default configuration? I recommend testing it yourself as I don’t have the environment here. Keep an eye on this issue and wait for further optimizations.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.