网站三天两头的变慢,找了很多原因,以前也发过帖子,http://q.cnblogs.com/q/63021/ 但是问题没能解决。
网站变慢的时候,服务器变得很卡,
1:用 【show processlis】命令 会打印出
+----------+------+-----------------+------+---------+------+--------------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----------+------+-----------------+------+---------+------+--------------------+------------------+
| 19021447 | root | 127.0.0.1:28253 | o2o | Query | 17 | removing tmp table | DESC fanwe_youhui_log |
| 19025616 | root | 127.0.0.1:32578 | NULL | Query | 0 | NULL | show processlist |
+----------+------+-----------------+------+---------+------+--------------------+------------------+
分析慢查询日志 N多下面的数据:
# Time: 140621 14:10:15
# User@Host: root[root] @ [127.0.0.1]
# Query_time: 24.078125 Lock_time: 0.000000 Rows_sent: 11 Rows_examined: 11
SET timestamp=1403331015;
DESC fanwe_youhui_log;
# Time: 140621 14:11:51
# User@Host: root[root] @ [127.0.0.1]
# Query_time: 14.312500 Lock_time: 0.015625 Rows_sent: 11 Rows_examined: 11
SET timestamp=1403331111;
DESC fanwe_youhui_log;
# Time: 140621 14:12:06
# User@Host: root[root] @ [127.0.0.1]
# Query_time: 10.843750 Lock_time: 0.015625 Rows_sent: 11 Rows_examined: 11
SET timestamp=1403331126;
DESC fanwe_youhui_log;
# Time: 140621 14:13:14
# User@Host: root[root] @ [127.0.0.1]
# Query_time: 26.656250 Lock_time: 0.000000 Rows_sent: 11 Rows_examined: 11
SET timestamp=1403331194;
DESC fanwe_youhui_log;
# Time: 140621 14:14:32
# User@Host: root[root] @ [127.0.0.1]
# Query_time: 10.312500 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
SET timestamp=1403331272;
select group_concat(focused_user_id) from fanwe_user_focus where focus_user_id = 33073 order by rand() limit 50;
# Time: 140621 14:15:10
# User@Host: root[root] @ [127.0.0.1]
# Query_time: 21.359375 Lock_time: 1.953125 Rows_sent: 11 Rows_examined: 11
SET timestamp=1403331310;
DESC fanwe_youhui_log;
# Time: 140621 14:16:28
# User@Host: root[root] @ [127.0.0.1]
# Query_time: 16.984375 Lock_time: 0.000000 Rows_sent: 11 Rows_examined: 11
SET timestamp=1403331388;
DESC fanwe_youhui_log;
===========================================
按道理说 DESC Table 命令应该是很快的命令,今天发现 Mylsq IO数据特别高,对这块我也不了解,想请大家分析下:
开监视工具,看下哪些sql造成的吧,
你需要优化sql操作
能否给推荐下 有哪些mysql 可以监控sql的工具