把执行计划复制进来看看,还有后面两个tab 中的内容(cop 读取和事务),也截个图看看
id | task | estRows | operator info | actRows | execution info | memory | disk | |
---|---|---|---|---|---|---|---|---|
Delete_5 | root | 0 | N/A | 0 | time:41.2ms, loops:1, lock_keys: {time:9.98s, region:5, keys:1298, resolve_lock:91.2ms, lock_rpc:40.769665683s, rpc_count:2, retry_count:1} | 477.6 KB | N/A | |
└─SelectLock_7 | root | 460 | for update 0 | 649 | time:27.2ms, loops:2 | N/A | N/A | |
└─IndexLookUp_13 | root | 460 | 649 | time:8.49ms, loops:2, index_task: {total_time: 1.55ms, fetch_handle: 1.46ms, build: 769ns, wait: 89.5µs}, table_task: {total_time: 6.16ms, num: 1, concurrency: 5} | 360.2 KB | N/A | ||
├─IndexRangeScan_11 | cop[tikv] | 460 | table:stat_day_longteng, index:event_date(event_date), range:[20210212,20210212], keep order:false | 649 | time:1.44ms, loops:3, cop_task: {num: 1, max: 1.37ms, proc_keys: 649, tot_proc: 1ms, rpc_num: 1, rpc_time: 1.35ms, copr_cache_hit_ratio: 0.00}, tikv_task:{time:1ms, loops:5}, scan_detail: {total_process_keys: 649, total_process_keys_size: 29854, total_keys: 650, rocksdb: {delete_skipped_count: 0, key_skipped_count: 649, block: {cache_hit_count: 9, read_count: 2, read_byte: 41.4 KB}}} | N/A | N/A | |
└─TableRowIDScan_12 | cop[tikv] | 460 | table:stat_day_longteng, keep order:false | 649 | time:5.61ms, loops:2, cop_task: {num: 1, max: 5.34ms, proc_keys: 649, tot_proc: 4ms, rpc_num: 1, rpc_time: 5.32ms, copr_cache_hit_ratio: 0.00}, tikv_task:{time:2ms, loops:5}, scan_detail: {total_process_keys: 649, total_process_keys_size: 179080, total_keys: 1299, rocksdb: {delete_skipped_count: 0, key_skipped_count: 1386, block: {cache_hit_count: 15, read_count: 6, read_byte: 57.1 KB}}} | N/A | N/A |
lock_keys: {time:9.98s, region:5, keys:1298, resolve_lock:91.2ms, lock_rpc:40.769665683s, rpc_count:2, retry_count:1}
问题在这了…
这些要删除的数据,是不是有别的服务在访问?[lock_rpc:40.769665683s] 锁数据要这么久,还有失败的…
要进一步查问题的话,只能去 grafana去查了,看 lock 的指标
好的,我这边看看先,感谢
我推荐两篇文章你看看,应该有帮助的
https://docs.pingcap.com/zh/tidb/stable/information-schema-data-lock-waits#data_lock_waits
https://docs.pingcap.com/zh/tidb/stable/troubleshoot-lock-conflicts#使用-lock-view-排查锁相关的问题
合理的优化一下
1 个赞
后面有遇到新问题的话,记得发新帖哟~
好的感谢
好的!
应该是同时有sql在读表
此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。