我运行一个相当活跃的学生博客,使用this event calendar plugin来显示学生浏览的即将发生的事件。
但是,我注意到该网站最近运行缓慢。我发现这是因为与插件相关的一组特定MySQL查询需要很长时间。以下是有问题的两个查询:Count: 88 Time=236.08s (20775s) Lock=0.00s (0s) Rows=13.7 (1204),
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_ec3_schedule ec3_sch ON ec3_sch.post_id=id WHERE N=N AND wp_posts.post_type = 'S' AND (wp_posts.post_status = 'S') AND ((YEAR(wp_posts.post_date)='S' AND MONTH(wp_posts.post_date)='S') OR ((YEAR(start)='S' AND MONTH(start)='S') OR (start<='S' AND end>='S'))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT N, N
Count: 19 Time=237.42s (4511s) Lock=0.00s (0s) Rows=5.4 (103),
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_ec3_schedule ec3_sch ON ec3_sch.post_id=id WHERE N=N AND wp_posts.post_type = 'S' AND (wp_posts.post_status = 'S') AND ((YEAR(wp_posts.post_date)=N AND MONTH(wp_posts.post_date)=N) OR ((YEAR(start)=N AND MONTH(start)=N) OR (start<='S' AND end>='S'))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT N, N
我确定它是插件,因为wp_ec3_schedule表是由插件创建的。
之前有没有人处理过这个特定的插件?或者,有谁知道为什么这些查询需要很长时间?正如你所看到的,他们花了将近5分钟,这是疯了。