时间:2021-07-01 10:21:17 帮助过:4人阅读
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| log_slow_queries | OFF |
| slow_launch_time | 2 |
+------------------+-------+
mysql> show global status like ‘%slow%‘;
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| Slow_launch_threads | 0 |
| Slow_queries | 279 |
+---------------------+-------+
mysql> show variables like ‘max_connections‘;
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 500 |
+-----------------+-------+
mysql> show global status like ‘max_used_connections‘;
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Max_used_connections | 498 |
+----------------------+-------+
mysql> show variables like ‘key_buffer_size‘;
+-----------------+----------+
| Variable_name | Value |
+-----------------+----------+
| key_buffer_size | 67108864 |
+-----------------+----------+
mysql> show global status like ‘key_read%‘;
+-------------------+----------+
| Variable_name | Value |
+-------------------+----------+
| Key_read_requests | 25629497 |
| Key_reads | 66071 |
+-------------------+----------+
mysql> show global status like ‘key_blocks_u%‘;
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Key_blocks_unused | 10285 |
| Key_blocks_used | 47705 |
+-------------------+-------+
mysql> show global status like ‘created_tmp%‘;
+-------------------------+---------+
| Variable_name | Value |
+-------------------------+---------+
| Created_tmp_disk_tables | 4184337 |
| Created_tmp_files | 4124 |
| Created_tmp_tables | 4215028 |
+-------------------------+---------+
mysql> show variables where Variable_name in (‘tmp_table_size‘, ‘max_heap_table_size‘);
+---------------------+-----------+
| Variable_name | Value |
+---------------------+-----------+
| max_heap_table_size | 134217728 |
| tmp_table_size | 134217728 |
+---------------------+-----------+
mysql> show global status like ‘open%tables%‘;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Open_tables | 1024 |
| Opened_tables | 1465 |
+---------------+-------+
mysql> show variables like ‘table_cache‘;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| table_cache | 1024 |
+---------------+-------+
mysql> show global status like ‘Thread%‘;
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 31 |
| Threads_connected | 239 |
| Threads_created | 2914 |
| Threads_running | 4 |
+-------------------+-------+
mysql> show variables like ‘thread_cache_size‘;
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| thread_cache_size | 32 |
+-------------------+-------+
mysql> show global status like ‘qcache%‘;
+-------------------------+----------+
| Variable_name | Value |
+-------------------------+----------+
| Qcache_free_blocks | 2226 |
| Qcache_free_memory | 10794944 |
| Qcache_hits | 5385458 |
| Qcache_inserts | 1806301 |
| Qcache_lowmem_prunes | 433101 |
| Qcache_not_cached | 4429464 |
| Qcache_queries_in_cache | 7168 |
| Qcache_total_blocks | 16820 |
+-------------------------+----------+
mysql> show variables like ‘query_cache%‘;
+------------------------------+----------+
| Variable_name | Value |
+------------------------------+----------+
| query_cache_limit | 33554432 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 33554432 |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
+------------------------------+----------+
mysql> show global status like ‘sort%‘;
+-------------------+----------+
| Variable_name | Value |
+-------------------+----------+
| Sort_merge_passes | 2136 |
| Sort_range | 81888 |
| Sort_rows | 35918141 |
| Sort_scan | 55269 |
+-------------------+----------+
mysql> show global status like ‘open_files‘;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Open_files | 821 |
+---------------+-------+
mysql> show variables like ‘open_files_limit‘;
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| open_files_limit | 65535 |
+------------------+-------+
mysql> show global status like ‘table_locks%‘;
+-----------------------+---------+
| Variable_name | Value |
+-----------------------+---------+
| Table_locks_immediate | 4257944 |
| Table_locks_waited | 25182 |
+-----------------------+---------+
mysql> show global status like ‘handler_read%‘;
+-----------------------+-----------+
| Variable_name | Value |
+-----------------------+-----------+
| Handler_read_first | 108763 |
| Handler_read_key | 92813521 |
| Handler_read_next | 486650793 |
| Handler_read_prev | 688726 |
| Handler_read_rnd | 9321362 |
| Handler_read_rnd_next | 153086384 |
+-----------------------+-----------+
mysql> show global status like ‘com_select‘;
+---------------+---------+
| Variable_name | Value |
+---------------+---------+
| Com_select | 2693147 |
+---------------+---------+
计算表扫描率:
表扫描率 = Handler_read_rnd_next / Com_select
如果表扫描率超过4000,说明进行了太多表扫描,很有可能索引没有建好,增加read_buffer_size值会有一些好处,但最好不要超过8MB。
REF:
http://www.90qh.com/html_250.html
http://www.cnblogs.com/AloneSword/p/3207697.html
http://jingyan.baidu.com/article/e5c39bf58f049339d76033f2.html
http://www.cnblogs.com/window07/archive/2009/11/11/1600826.html
http://blog.csdn.net/skykingf/article/details/19919411
mysql for windows之my.ini优化
标签: