Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: tidb慢查询问题

[TiDB Usage Environment] Production Environment / Testing / Poc
[TiDB Version] 6.5
[Reproduction Path]
[Encountered Problem: Problem Phenomenon and Impact] Querying a single table with 150 million records in TiDB takes about 20 seconds, while in MySQL it takes less than 10 seconds.
[Resource Configuration]
TiDB Resource Configuration:
MySQL Configuration: 16 cores, 32GB memory
[Attachments: Screenshots/Logs/Monitoring]
- Execution Plan
Execution Plan Execution Info Details:
First Line: time: 19.4s, loops: 2
Second Line: time: 19.4s, loops: 23638, cop_task: {num: 770, max: 1.97s, min: 441.3µs, avg: 292.5ms, p95: 937.8ms, max_proc_keys: 50144, p95_proc_keys: 50144, tot_proc: 31.4s, tot_wait: 176ms, rpc_num: 772, rpc_time: 3m45.2s, copr_cache_hit_ratio: 0.04, distsql_concurrency: 15}, backoff{regionMiss: 2ms}
Third Line: tikv_task: {proc max: 178ms, min: 0s, avg: 31.7ms, p80: 49ms, p95: 85ms, iters: 26649, tasks: 770}, scan_detail: {total_process_keys: 24095603, total_process_keys_size: 4728933683, total_keys: 24096342, get_snapshot_time: 126.9ms, rocksdb: {key_skipped_count: 24095603, block: {cache_hit_count: 70926, read_count: 5042, read_byte: 19.9 MB, read_time: 42.4ms}}}
Fourth Line: tikv_task: {proc max: 178ms, min: 0s, avg: 31.7ms, p80: 49ms, p95: 85ms, iters: 26649, tasks: 770}
- Table Creation Statement