mysql 5.6 inner join查询慢的优化方案
SELECT
DISTINCT Bus_CompleteList.WXOpenId, Bus_UserList.WXNickName
FROM
Bus_CompleteList
inner join Bus_UserList on Bus_UserList.WXOpenId=Bus_CompleteList.WXOpenId
ORDER BY Bus_CompleteList.CreateTime DESC LIMIT 0,10
将inner join 后续的SQL语句变成子查询
SELECT
AR.WXOpenId, Bus_UserList.WXNickName
FROM
(select DISTINCT WXOpenId from Bus_CompleteList ORDER BY CreateTime DESC LIMIT 0,10) AR
inner join Bus_UserList on Bus_UserList.WXOpenId=AR.WXOpenId
每天一点点。。。