Bug 反馈
集群升级7.10后,原来简单的sql 执行变慢,基本出现翻倍或者更多的情况,对比之下计划,发现total_process_keys 增加2个数量级
【 TiDB 版本】7.1.0
【 Bug 的影响】业务的整体任务调度都受到影响
【可能的问题复现步骤】
【看到的非预期行为】7版本执行计划
| StreamAgg_20 | 1.00 | 1 | root | | time:10.1s, loops:2, RU:525106.464870 | funcs:count(Column#10)->Column#5 | 4.19 KB | N/A |
| └─IndexReader_21 | 1.00 | 405 | root | | time:10.1s, loops:2, cop_task: {num: 405, max: 1.03s, min: 301.6µs, avg: 364.4ms, p95: 617.5ms, max_proc_keys: 1177355, p95_proc_keys: 1139515, tot_proc: 2m17.8s, tot_wait: 168.5ms, rpc_num: 405, rpc_time: 2m27.6s, copr_cache_hit_ratio: 0.09, build_task_duration: 1.05ms, max_distsql_concurrency: 15} | index:StreamAgg_8 | 721 Bytes | N/A |
| └─StreamAgg_8 | 1.00 | 405 | cop[tikv] | | tikv_task:{proc max:1.03s, min:170ms, avg: 397.6ms, p80:506ms, p95:617ms, iters:313964, tasks:405}, scan_detail: {total_process_keys: 293431895, total_process_keys_size: 31397210713, total_keys: 293432280, get_snapshot_time: 125.4ms, rocksdb: {delete_skipped_count: 228, key_skipped_count: 296859919, block: {cache_hit_count: 918691, read_count: 5, read_byte: 104.4 KB, read_time: 73.8µs}}} | funcs:count(1)->Column#10 | N/A | N/A |
| └─IndexFullScan_19 | 321297271.00 | 321297993 | cop[tikv] | table:dws_datav_new_register_user_real, index:uniq_card(CH_ID_CARD_ENCRYPT) | tikv_task:{proc max:1.03s, min:170ms, avg: 396.6ms, p80:503ms, p95:616ms, iters:313964, tasks:405}
【期望看到的行为】5版本执行计划
id task estRows operator info actRows execution info memory disk
StreamAgg_20 root 1 funcs:count(Column#10)->Column#5 1 time:584.6ms, loops:2 4.18 KB N/A
└─IndexReader_21 root 1 index:StreamAgg_8 405 time:584.6ms, loops:2, cop_task: {num: 405, max: 559.3ms, min: 221.3µs, avg: 5.65ms, p95: 10.8ms, max_proc_keys: 1128106, p95_proc_keys: 0, tot_proc: 1.51s, tot_wait: 488ms, rpc_num: 405, rpc_time: 2.28s, copr_cache_hit_ratio: 0.99} 1.17 KB N/A
└─StreamAgg_8 cop[tikv] 1 funcs:count(1)->Column#10 405 tikv_task:{proc max:1.02s, min:170ms, p80:492ms, p95:673ms, iters:311496, tasks:405}, scan_detail: {total_process_keys: 2852371, total_keys: 2852374, rocksdb: {delete_skipped_count: 9, key_skipped_count: 2852380, block: {cache_hit_count: 4501, read_count: 0, read_byte: 0 Bytes}}} N/A N/A
└─IndexFullScan_19 cop[tikv] 318769361 table:dws_datav_new_register_user_real, index:uniq_card(CH_ID_CARD_ENCRYPT), keep order:false 318769817 tikv_task:{proc max:1.02s, min:169ms, p80:490ms, p95:672ms, iters:311496, tasks:405}, scan_detail: {total_process_keys: 0, total_keys: 0, rocksdb: {delete_skipped_count: 0, key_skipped_count: 0, block: {cache_hit_count: 0, read_count: 0, read_byte: 0 Bytes}}} N/A N/A