Mysql性能監控項及sql語句


推薦一款mysql監控軟件MONyog

1、查詢緩存:

  mysql> show variables like '%query_cache%';

 2、緩存在Cache中線程數量thread_cache_size:

  mysql> show variables like 'thread%';

3、DB已連接的線程數:

  mysql> show status like 'connections';

4、當前連接線程狀態:

  mysql> show status like '%thread%';

5、索引緩存大小:

  mysql> show variables like 'key_buffer_size';

6、索引緩存未命中率:

  mysql> show global status like 'key_read%';

7、索引緩存命中率:

  mysql> show global status like 'key_%';

8、索引讀取統計:

  mysql> show global status like 'key_blocks_u';

  key_blocks_unused表示未使用的緩存簇(blocks)數,key_blocks_used表示曾經用到的最大的blocks,如果緩存都用到了,要么增加key_buffer_size,要么過度索引,把緩存占滿了。

9、並發最大連接數-允許最大連接數(一般500到800比較合適):

  mysql> show variables like 'max_connections';

10、並發最大連接數-服務器響應最大連接數:

  mysql> show global status like 'max_used_connections';

11、並發最大連接數-當前連接數:

  mysql> show global status like 'connections';

12、並發最大連接數-線程隊列(值越小越好):

  mysql> show variables like 'back_log';

13、臨時表:

  mysql> show global status like 'created_tmp%';

  臨時表比較大無法在內存完成時就不得使用磁盤文件,如果'created_tmp_tables非常大,則可能是系統中的排序操作過多,或者是表連接方式優化不夠。

14、mysql服務器對臨時表的配置:

  mysql> show variables where variable_name  in ('temp_able_siae','max_heap_table_size');

  當臨時表空間小於max_heap_table_size時,才能全部放入內存。

15、表掃描情況:

  mysql> show global status like 'handler_read%';

  mysql> show global status like 'com_select';

  如果表掃描率超過4000,說明進行太多表掃描,可能索引沒有建好,增加read_buffer_size值會有好處,但不要查8M。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM