?????嵥 7. ????????????
????mysql> SHOW STATUS LIKE 'created_tmp%';
????+-------------------------+-------+
????| Variable_name | Value |
????+-------------------------+-------+
????| Created_tmp_disk_tables | 30660 |
????| Created_tmp_files | 2 |
????| Created_tmp_tables | 32912 |
????+-------------------------+-------+
????3 rows in set (0.00 sec)
?????????????????????? Created_tmp_tables;???????????????? Created_tmp_disk_tables??????????????????????????????????????????漰????????????? Created_tmp_disk_tables ????????????????????????????????????Ч??? tmp_table_size ?? max_heap_table_size ?????????????????С???????????? my.cnf ?ж???????????????????á?
???????????????
??????????Щ????????????????????????Щ????????????????????????????????????????????Щ??????????????!??????????????????е???Щ??????????? my.cnf ??????л??????Щ???á?
?????? MySQL ???????????????????????????????????????????????????????Щ?????С????????????????????????????浽??????????????У?????ν?????????? sort_merge_passes ??????????????????????????嵥 8 ???????Щ???????????????????????
?????嵥 8. ?????????????
????mysql> SHOW STATUS LIKE "sort%";
????+-------------------+---------+
????| Variable_name | Value |
????+-------------------+---------+
????| Sort_merge_passes | 1 |
????| Sort_range | 79192 |
????| Sort_rows | 2066532 |
????| Sort_scan | 44006 |
????+-------------------+---------+
????4 rows in set (0.00 sec)
??????? sort_merge_passes ???????????? sort_buffer_size?????磬 sort_buffer_size = 4M ??????????????? 4MB??
????MySQL ???????Щ???????????????????£????????????????????????????????????У????????????(????????????????)?????????д????????????????????????????????????? SELECT ???????????????е??????????????(???????????????????)????????????????????嵥 9 ?????
?????嵥 9. ???????????
????mysql> SHOW STATUS LIKE "com_select";
????+---------------+--------+
????| Variable_name | Value |
????+---------------+--------+
????| Com_select | 318243 |
????+---------------+--------+
????1 row in set (0.00 sec)
????mysql> SHOW STATUS LIKE "handler_read_rnd_next";
????+-----------------------+-----------+
????| Variable_name | Value |
????+-----------------------+-----------+
????| Handler_read_rnd_next | 165959471 |
????+-----------------------+-----------+
????1 row in set (0.00 sec)
????Handler_read_rnd_next / Com_select ?ó?????????? —— ????????? 521:1???????????? 4000????ò? read_buffer_size?????? read_buffer_size = 4M????????????????? 8M??????????????????????Щ??????е?????!
????3 ?????????????
???????????????????????SHOW STATUS ????????????????????????Щ?????????? mysqld ????????????????????? 3 ???????????????;?? ?ο????? ????????????????????????
??????????????????????? top ?????????????????? CPU ??????????????????μ?????? mytop ?? top ?????????;????????????????????????????????е???????????????mytop ??????????й??????????????????Ч??????????????????????й????????е????????????????????????????????????????(???? 10 ???????)????????????????й???????????????????????????????????κ??????
????mysqlard ?????????? MySQL ????????????????????? 5 ???????????????????????洢?????????? Round Robin Database ?С?????? Web ?????????Щ???????????????????????????Ч??????????????????????????????????? mytop ?????????????????????????? mysqlard ???????????????????????????mysqlard ??????????????Щ????????ζ?????????е???????Щ???顣
??????? SHOW STATUS ?????????????????? mysqlreport?????????? mysqlard ?????????????????????????????涼???з??????????????????е???????????????????????????????????????????????????????????Щ????
??????????
?????????????? MySQL ???е?????Щ?????????????????? LAMP ??????е???? 3 ????????????????????????????????????????????????????????????????????????Щ?????????????????????? —— Linux??Apache??PHP ?? MySQL —— ???и???????????????????????????????????????????ó????????????????
????mytop??÷?????
????# mytop -u root -p 123456 -d mydb_name
????????????
??????????????????????????????? MySQL ????????? (?? days+hour:minutes:seconds ????)??
????????е? Queries ???????????е? SQL ????????????????????????????????????
?????????е? Key Efficiency ?????е?????????????????????????????????? MySQL ??????????????±????????滹?????????????
?????·??????????????????????????????????? k ??????????????? f ???????????????
??????????myql????????mysql???????????????????????????????????????mysql????????.