1、AWS查询慢日志
select count(1) ,user_host from mysql.slow_log group by user_host;
select count(*) from mysql.slow_log ;
mysql> desc mysql.slow_log ;
+----------------+---------------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------------+------+-----+-------------------+-----------------------------+
| start_time | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| user_host | mediumtext | NO | | NULL | |
| query_time | time | NO | | NULL | |
| lock_time | time | NO | | NULL | |
| rows_sent | int(11) | NO | | NULL | |
| rows_examined | int(11) | NO | | NULL | |
| db | varchar(512) | NO | | NULL | |
| last_insert_id | int(11) | NO | | NULL | |
| insert_id | int(11) | NO | | NULL | |
| server_id | int(10) unsigned | NO | | NULL | |
| sql_text | mediumtext | NO | | NULL | |
| thread_id | bigint(21) unsigned | NO | | NULL | |
+----------------+---------------------+------+-----+-------------------+-----------------------------+
mysql> select query_time,sql_text from mysql.slow_log order by query_time desc limit 30; -- 慢查询安装时间排序
mysql> select query_time,sql_text from mysql.slow_log where query_time >'00:00:10'; --查询大于10s的慢查询
原文地址:http://blog.51cto.com/395469372/2106954