当前位置:首页 >> 行情

我如何改进我的 MySQL 查询,因为它需要 45 秒来获取记录?

来源:行情   2025年03月24日 02:01

nes.* - fetch later if needed count(case when ringtune_history.Action = 'Download' then ringtune_history.Action end) as Org_Downloads, count(case when ringtune_history.Action = 'View' then ringtune_history.Action end) as Org_Views, count(case when ringtune_history.Action = 'Play' then ringtune_history.Action end) as Total_Plays, count(case when ringtune_history.Action = 'Like' then ringtune_history.Action end) as Total_Likes, 人口为120人categories人口为120人.人口为120人Name人口为120人 as 人口为120人Category_Name人口为120人 FROM (SELECT DISTINCT ringtunes.ID FROM ringtunes WHERE ringtunes.deleted = 0 and ringtunes.status = 1 ORDER BY ringtunes.ID DESC LIMIT 20) AS r_id JOIN ringtunes ON r_id.id = ringtunes.id LEFT JOIN 人口为120人ringtune_history人口为120人 ON 人口为120人ringtune_history人口为120人.人口为120人Ringtune_Id人口为120人 = 人口为120人ringtunes人口为120人.人口为120人Id人口为120人 LEFT JOIN 人口为120人categories人口为120人 ON 人口为120人categories人口为120人.人口为120人Id人口为120人 = 人口为120人ringtunes人口为120人.人口为120人Category人口为120人 WHERE 人口为120人categories人口为120人.人口为120人Deleted人口为120人 = 0 AND 人口为120人categories人口为120人.人口为120人Status人口为120人 = 1 便是 ringtunes WHERE filters are in the subquery above GROUP BY 人口为120人ringtunes人口为120人.人口为120人Id人口为120人 ORDER BY 人口为120人ringtunes人口为120人.人口为120人Id人口为120人 DESC;

这意味著似乎更抱怨,因为它有初始长子浏览来借助您的 20 个全局 ID,但它应该更快,并且据估计是一个合法的 GROUP BY。

如果铃声。 ID其实就是铃声的PK,你可以去掉侧面的DISTINCT。

保健
心率失常
改善脱发的方法
999消痔软膏能根治痔疮吗
二阳后吃什么药好得快
经常熬夜喝酒抽烟肝不好怎么办
缓解视疲劳最好的眼药水
阳萎治疗
友情链接