由于mysql守护程序,我的服务器的平均负载非常高,有时甚至超过100.0。首先我认为它是因为mysql的慢查询,这里是mysql-slow.log的一个片段:
# Time: 150423
6:38:03
# User@Host: root[root] @ localhost []
# Query_time: 1.349115 Lock_time: 0.000181 Rows_sent: 40 Rows_examined: 16552
SET timestamp=1429763883;
SELECT * FROM videos, videos_tags WHERE videos.Id = videos_tags.Id AND videos.ImporterTag=0 AND Published IS NOT NULL ORDER BY Published DESC LIMIT 0,40;
# Time: 150423 6:38:36
# User@Host: root[root] @ localhost []
# Query_time: 2.110382 Lock_time: 0.000107 Rows_sent: 40 Rows_examined: 18517
use db;
SET timestamp=1429763916;
SELECT * FROM videos, videos_tags WHERE videos.Id = videos_tags.Id AND videos.ImporterTag=0 AND Published IS NOT NULL ORDER BY Published DESC LIMIT 1080,40;
# Time: 150423 6:39:26
# User@Host: root[root] @ localhost []
# Query_time: 1.855701 Lock_time: 0.000075 Rows_sent: 200 Rows_examined: 19316
use db;
SET timestamp=1429763966;
SELECT * FROM videos, videos_tags WHERE videos.Id = videos_tags.Id AND videos.ImporterTag=0 AND Published IS NOT NULL ORDER BY RAND() LIMIT 0,200;
之后我收到一些消息,表格被标记为“崩溃”。我使用mysqlcheck和myisamchk修复它们,直到现在它似乎运行正常。
有人可以告诉我这些查询是否像慢速查询?如果没有,失败应该是因为崩溃的数据库。