?????????????????????????????????????????????????MYSQL????????????е?????????????
????=========================================================
??????????? ????????????????????????????????????
????Mysql5.0?????汾??????????б??????SQL???????????
????mysql> show variables like 'long%';     ??????long_query_time???????????????????????“?????”
????+-----------------+-----------+
????| Variable_name   | Value     |
????+-----------------+-----------+
????| long_query_time | 10.000000 |
????+-----------------+-----------+
????1 row in set (0.00 sec)
????mysql> set long_query_time=1;   ??? ????????1?? ???????????1?????????????
????Query OK?? 0 rows affected (0.00 sec)
????mysql> show variables like 'slow%';
????+---------------------+---------------+
????| Variable_name       | Value         |
????+---------------------+---------------+
????| slow_launch_time    | 2             |
????| slow_query_log      | ON            |           ?????????????
????| slow_query_log_file | /tmp/slow.log |      ??? ???????λ??
????+---------------------+---------------+
????3 rows in set (0.00 sec)
????mysql> set global slow_query_log='ON'   ???????????
???????slow_query_log???????????ON??mysql??????????????
????/etc/my.cnf   ???????????????MYSQL?????????????
????long_query_time=1
????slow_query_log_file=/tmp/slow.log
????====================================================
??????????:mysqldumpslow????
????/path/mysqldumpslow -s c -t 10 /tmp/slow-log
????????????????????10??SQL??????У?
????-s?? ?????????????????c??t??l??r????????????????????????????????????????ac??at??al??ar?????????????
????-t?? ??top n?????????????????????????????
????-g?? ??????д????????????????Сд????е??
????????
????/path/mysqldumpslow -s r -t 10 /tmp/slow-log
??????????????????10???????
????/path/mysqldumpslow -s t -t 10 -g “left join” /tmp/slow-log
????????????????????10?????溬??????????????