【 TiDB 使用环境】生产环境
【 TiDB 版本】5.3.2
【遇到的问题】
排查慢SQL的过程中发现Coprocessor的监控很不正常,延时比较高,抖动明显:
这是一个可能与之有关的执行计划:
id task estRows operator info actRows execution info memory disk
IndexLookUp_10 root 3 1 time:7.87s, loops:2, index_task: {total_time: 7.86s, fetch_handle: 7.86s, build: 1.35µs, wait: 1.86µs}, table_task: {total_time: 5.33ms, num: 1, concurrency: 5} 31.8 KB N/A
├─IndexRangeScan_8 cop[tikv] 3 table:xxx, index:IDX_ba_cust_ordertype(partner_id, cust_id, order_type_id), range:["kejie" "1200002260" "020291","dfa" "1200002260" "020291"], keep order:false 1 time:7.86s, loops:3, cop_task: {num: 1, max: 7.86s, proc_keys: 1, rpc_num: 1, rpc_time: 7.86s, copr_cache_hit_ratio: 0.00}, tikv_task:{time:0s, loops:1}, scan_detail: {total_process_keys: 1, total_process_keys_size: 118, total_keys: 2, rocksdb: {delete_skipped_count: 0, key_skipped_count: 1, block: {cache_hit_count: 9, read_count: 0, read_byte: 0 Bytes}}} N/A N/A
└─TableRowIDScan_9 cop[tikv] 3 table:xxx, keep order:false 1 time:5.2ms, loops:2, cop_task: {num: 1, max: 5.13ms, proc_keys: 1, rpc_num: 1, rpc_time: 5.12ms, copr_cache_hit_ratio: 0.00}, tikv_task:{time:0s, loops:1}, scan_detail: {total_process_keys: 1, total_process_keys_size: 262, total_keys: 1, rocksdb: {delete_skipped_count: 0, key_skipped_count: 0, block: {cache_hit_count: 8, read_count: 0, read_byte: 0 Bytes}}} N/A N/A
单表查询,总行数只有5万多,命中的索引区分度非常高,cop处理时间却很长:
下一步该如何排查:rofl:
付完整的TiKV监控数据:
tidb-TiKV-Details_2022-09-23T09_57_24.748Z.json (900.0 KB)