2020-08-14 MySQL查看數(shù)據(jù)庫性能常用命令

轉(zhuǎn)MySQL查看數(shù)據(jù)庫性能常用命令
mysql> show global status; 列出MySQL服務(wù)器運行各種狀態(tài)值
mysql> show variables; 查詢MySQL服務(wù)器配置信息語句

一、慢查詢   
  mysql> show variables like '%slow%';
  mysql> show global status like '%slow%';

二、連接數(shù)
  mysql> show variables like 'max_connections'; max_connections值過小:
  mysql> show global status like ‘Max_used_connections’;

三、Key_buffer_size   
  mysql> show variables like ‘key_buffer_size’; 以MyISAM為主要存儲引擎服務(wù)器的配置
  mysql> show global status like 'key_read%'; key_buffer_size的使用情況
  mysql> show global status like 'key_blocks_u%'; key_blocks_*參數(shù)

四、臨時表
  mysql> show global status like 'created_tmp%';
  mysql> show variables where Variable_name in ('tmp_table_size', 'max_heap_table_size'); MySQL服務(wù)器對臨時表的配置

五、Open Table情況
  mysql> show global status like 'open%tables%'; Open_tables表示打開表的數(shù)量,Opened_tables表示打開過的表數(shù)量
  mysql> show variables like 'table_cache'; 服務(wù)器table_cache值

六、進程使用情況
  mysql> show global status like ‘Thread%’; Threads_created表示創(chuàng)建過的線程數(shù)
  mysql> show variables like 'thread_cache_size'; 查詢服務(wù)器thread_cache_size配置

七、查詢緩存(query cache)
  mysql> show global status like 'qcache%';
  mysql> show variables like 'query_cache%'; 服務(wù)器關(guān)于query_cache的配置

八、排序使用情況
  mysql> show global status like 'sort%';

九、文件打開數(shù)(open_files)
  mysql> show global status like 'open_files';

十、表鎖情況
  mysql> show global status like 'table_locks%';

十一、表掃描情況
  mysql> show global status like 'handler_read%';
  mysql> show global status like 'com_select'; 調(diào)出服務(wù)器完成的查詢請求次數(shù)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容