背景为一张13亿左右数据的表,通过非事务dml删除了10亿条左右数据,剩余了2亿条左右的数据
现在执行 select * from xxx limit 1 需要3分钟多才能出结果
如果在where条件里使用索引查询是正常的
执行计划:
Limit_7 1.00 1 root time:3m24.4s, loops:2 offset:0, count:1 N/A N/A
└─IndexReader_14 1.00 1 root time:3m24.4s, loops:1, cop_task: {num: 1829, max: 402.8ms, min: 134.9µs, avg: 111.7ms, p95: 246.4ms, max_proc_keys: 1, p95_proc_keys: 0, tot_proc: 3m22.7s, tot_wait: 42ms, rpc_num: 1829, rpc_time: 3m24.3s, copr_cache_hit_ratio: 0.46, distsql_concurrency: 1} index:Limit_13 326 Bytes N/A
└─Limit_13 1.00 1 cop[tikv] tikv_task:{proc max:472ms, min:33ms, avg: 186.8ms, p80:229ms, p95:280ms, iters:1829, tasks:1829}, scan_detail: {total_process_keys: 1, total_process_keys_size: 46, total_keys: 851728674, get_snapshot_time: 283.7ms, rocksdb: {delete_skipped_count: 19440216, key_skipped_count: 871167911, block: {cache_hit_count: 11891, read_count: 554620, read_byte: 5.93 GB, read_time: 2.09s}}} offset:0, count:1 N/A N/A
└─IndexFullScan_11 1.00 1 cop[tikv] table:h_equip_bin_box_status_history, index:idx_gmt_create(gmt_create) tikv_task:{proc max:472ms, min:33ms, avg: 186.8ms, p80:229ms, p95:280ms, iters:1829, tasks:1829} keep order:false N/A N/A