??????????壬?????????м???????????????? query

??????????????????????????????????????SQL?????????????????????

?????÷?????????????long_query_time?????á??????10??

????????????????????????????????long_query_time????????????????

?????????????????????ж????long_query_time????????????

mysql> show variables like 'log_slow_queries';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| log_slow_queries | ON    |
+------------------+-------+
1 row in set (0.00 sec)

mysql> show variables like 'long_query_time';
+-----------------+-----------+
| Variable_name   | Value     |
+-----------------+-----------+
| long_query_time | 10.000000 |
+-----------------+-----------+
1 row in set (0.00 sec)

????????????????????????????log_queries_not_using_indexes

??????????е?SQL??????????????MySQL???????????????????????????

mysql> show variables like 'log_queries_not_using_indexes';
+-------------------------------+-------+
| Variable_name                 | Value |
+-------------------------------+-------+
| log_queries_not_using_indexes | OFF   |
+-------------------------------+-------+
1 row in set (0.00 sec)

??????????????п???????е???????????????????ò??????????б?????????????Ч

????MySQL ????????????????????????????????? mysqldumpslow??????????MySQL DBA???????????????????

???????????? TOP-5 SQL???

[mysql@localhost bin]$ ./mysqldumpslow -s al -n 5 /home/mysql/mysql/log/slow.log

Reading mysql slow query log from /home/mysql/mysql/log/slow.log
Count: 1  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=0.0 (0)?? 0users@0hosts