优化查询mysql执行时间

时间:2014-02-01 23:50:34

标签: mysql optimization

我有一个mysql查询

 SELECT us.recNo, CONCAT(us.firstname,"",us.lastname) as fullname, max(dy.date) as Diarydate
 FROM users us JOIN diary dy on us.recNo = dy.clientID AND dy.date > (SELECT max(DATE(dateTime)) FROM `history` WHERE userID=us.managerID) OR dy.date is NULL
 WHERE us.managerID = 6 and us.accountStatus = 2 and us.securityGroup = 50 
 GROUP BY us.recNo, fullname
 ORDER BY fullname

但执行时间非常糟糕,导致页面加载速度变慢。 有人能告诉我如何快速完成并改进查询吗?

0 个答案:

没有答案