为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
- 【TiDB 版本】:2.1.9
- 【问题描述】:select table_id, is_index, hist_id, distinct_count, version, null_count, tot_col_size, stats_ver, flag from mysql.stats_histograms where table_id = xxx;
这条SQL正常执行在0.1s内可以完成,最近发现慢日志(300ms),这类SQL执行时间大多在10s是40s之间,这个问题一般由什么引起的可能性最大
若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出打印结果,请务必全选并复制粘贴上传。
QBin
(Bin)
2
麻烦给一条 slowlog 里面关于这个 SQL 的完整内容。
Time: 2020-01-16T08:41:07.938533014+08:00
Txn_start_ts: 413960826952351755
Query_time: 33.267387386
Process_time: 0.002 Wait_time: 34.621 Request_count: 3 Total_keys: 28 Process_keys: 12
Index_ids: [1]
Is_internal: true
Digest: cc9584e3930bfa56d664b753753ca4857d7dbf747c14f639db76114cbdb2bb42
Stats: stats_histograms:pseudo
Num_cop_tasks: 3
Cop_proc_avg: 0.000666666 Cop_proc_p90: 0.001 Cop_proc_max: 0.001
Cop_wait_avg: 11.540333333 Cop_wait_p90: 17.206 Cop_wait_max: 17.206
Mem_max: 3826
select table_id, is_index, hist_id, distinct_count, version, null_count, tot_col_size, stats_ver, flag from mysql.stats_histograms where table_id = xxx;