为提高效率,请提供以下信息,问题描述清晰能够更快得到解决:
【TiDB 版本】TiDB v4.0.9 MySQL8.0.14
【问题描述】我们项目发现有一条SQL语句在mysql下查询很快,0秒就能查询出结果,但在tidb数据库集群里面查询很慢,查询一次2000秒还没出来结果,请帮忙看下是什么原因导致的,谢谢
SQL查询语句:
SELECT m.id,message_id AS messageId,send_user_id AS sendFrom,receive_user_id AS sendTo,send_time AS sendTime,receive_time AS receiveTime,content AS message,system_id,customer_id, send_user_name AS sendFromName,receive_user_name AS sendToName, s.system_code, m.customer_id
FROM tbl_message AS m
LEFT JOIN tbl_system AS s ON m.system_id = s.id
WHERE receive_user_id = 131503 AND IFNULL(receive_time,0) = 0
ORDER BY send_time ASC
这是我们TiDB集群查询的结果
查询了2000秒还没出来结果
expain分析的结果
这是mysql查询的结果
我们的数据库脚本已上传腾讯云盘
https://share.weiyun.com/pcoBjElF
整个tidb集群状态都工作正常
请帮忙看下是什么原因导致的?查询为什么会非常慢