【 TiDB 使用环境】生产环境
【 TiDB 版本】
【复现路径】做过哪些操作出现的问题
循环执行下面语句
delete from table where I_DATE =20230601 limit 1000,总共需要删除8万多条,表的总数据量在7000万
【遇到的问题:问题现象及影响】
一开始非常快,慢慢越来越慢,后面一次删除需要2秒多
{total_process_keys: 1000, total_keys: 680001, rocksdb: {delete_skipped_count: 2000, key_skipped_count: 597000
执行计划
2023-07-31, 2.31, 0, id task estRows operator info actRows execution info memory disk
Delete_5 root 0 N/A 0 time:2.28s, loops:1, commit_txn: {prewrite:30.9ms, get_commit_ts:135.2µs, commit:6.97ms, region_num:16, write_keys:5000, write_byte:208404} 1.19 MB N/A
└─IndexLookUp_19 root 4.00 limit embedded(offset:0, count:1000) 1000 time:2.26s, loops:2, index_task: {total_time: 2.21s, fetch_handle: 2.21s, build: 855ns, wait: 2.25µs}, table_task: {total_time: 17.7s, num: 1, concurrency: 8} 1.10 MB N/A
├─Limit_18 cop[tikv] 4.00 offset:0, count:1000 1000 time:2.21s, loops:1, cop_task: {num: 1, max: 1.14s, proc_keys: 1000, tot_proc: 1.11s, tot_wait: 22ms, rpc_num: 2, rpc_time: 2.21s, copr_cache_hit_ratio: 0.00}, ResolveLock:{num_rpc:1, total_time:1.12ms}, tikv_task:{time:1.08s, loops:6}, scan_detail: {total_process_keys: 1000, total_keys: 680001, rocksdb: {delete_skipped_count: 2000, key_skipped_count: 597000, block: {cache_hit_count: 722, read_count: 7, read_byte: 84.1 KB}}} N/A N/A
│ └─IndexRangeScan_16 cop[tikv] 4.00 table:table, index:UNIQ_DT(I_DATE, a_ID, I_MON_TYPE, b_ID), range:[20230622,20230622], keep order:false 1000 tikv_task:{time:1.08s, loops:6}, 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
└─TableRowIDScan_17 cop[tikv] 4.00 table:table, keep order:false, stats:pseudo 1000 time:46.5ms, loops:2, cop_task: {num: 3, max: 45.3ms, min: 2.21ms, avg: 16.8ms, p95: 45.3ms, max_proc_keys: 902, p95_proc_keys: 902, tot_proc: 42ms, tot_wait: 1ms, rpc_num: 3, rpc_time: 50.1ms, copr_cache_hit_ratio: 0.00}, tikv_task:{proc max:36ms, min:2ms, p80:36ms, p95:36ms, iters:9, tasks:3}, scan_detail: {total_process_keys: 1000, total_keys: 1010, rocksdb: {delete_skipped_count: 0, key_skipped_count: 30, block: {cache_hit_count: 12146, read_count: 3, read_byte: 39.9 KB}}} N/A N/A, DELETE FROM table WHERE I_DATE = ? LIMIT 1000 [arguments: 20230622];, 3a0a4c969b2b6d559ca72148d0432c8e486e9f805f41fc012c6e23b98369965e
【资源配置】进入到 TiDB Dashboard -集群信息 (Cluster Info) -主机(Hosts) 截图此页面
【附件:截图/日志/监控】