1扭勉、查詢緩存:
mysql> show variables like '%query_cache%';
2皂冰、緩存在Cache中線程數(shù)量thread_cache_size:
mysql> show variables like 'thread%';
3店展、DB已連接的線程數(shù):
mysql> show status like 'connections';
4、當(dāng)前連接線程狀態(tài):
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概说、索引讀取統(tǒng)計:
mysql> show global status like 'key_blocks_u';
key_blocks_unused表示未使用的緩存簇(blocks)數(shù)碧注,key_blocks_used表示曾經(jīng)用到的最大的blocks,如果緩存都用到了糖赔,要么增加key_buffer_size萍丐,要么過度索引,把緩存占滿了放典。
9逝变、并發(fā)最大連接數(shù)-允許最大連接數(shù)(一般500到800比較合適):
mysql> show variables like 'max_connections';
10、并發(fā)最大連接數(shù)-服務(wù)器響應(yīng)最大連接數(shù):
mysql> show global status like 'max_used_connections';
11奋构、并發(fā)最大連接數(shù)-當(dāng)前連接數(shù):
mysql> show global status like 'connections';
12壳影、并發(fā)最大連接數(shù)-線程隊列(值越小越好):
mysql> show variables like 'back_log';
13腰池、臨時表:
mysql> show global status like 'created_tmp%';
臨時表比較大無法在內(nèi)存完成時就不得使用磁盤文件渠啤,如果'created_tmp_tables非常大,則可能是系統(tǒng)中的排序操作過多次企,或者是表連接方式優(yōu)化不夠醋火。
14悠汽、mysql服務(wù)器對臨時表的配置:
mysql> show variables where variable_name in ('temp_able_siae','max_heap_table_size');
當(dāng)臨時表空間小于max_heap_table_size時,才能全部放入內(nèi)存芥驳。
15柿冲、表掃描情況:
mysql> show global status like 'handler_read%';
mysql> show global status like 'com_select';
如果表掃描率超過4000,說明進行太多表掃描兆旬,可能索引沒有建好假抄,增加read_buffer_size值會有好處,但不要查8M丽猬。