
Mysql数据库是一款使用广泛的开源数据库,作为一款开源的免费产品,其并不像oracle那样功能强大,且不自带可视化监控与报警组件,更关键的是其“动态性能视图”远不如oracle丰富,对初学者来说,mysql在其运行过程中相比oracle更加黑盒,更加不可观测。因此我们来研究mysql提供的一些可供参考的数据库状态维度。
SHOW GLOBAL STATUS WHERE variable_name in ('com_select','com_insert', 'com_update', 'com_ delete');
SHOW GLOBAL STATUS WHERE variable_name in (' Questions ',' Uptime ');
QPS=Questions/Uptime
SHOW GLOBAL STATUS WHERE variable_name in (' Com_commit ',' Com_rollback ');Com_commit';Com_rollback = SHOW GLOBAL STATUS LIKE 'Com_rollback';Uptime = SHOW GLOBAL STATUS LIKE 'Uptime';TPS=(Com_commit + Com_rollback)/Uptime
R/W=(Com_select + Qcache_hits) (Com_insert + Com_update + Com_delete + Com_replace)
show status WHERE variable_name in ('connections','threads_cached','threads_connected','max_used_connections', 'threads_created','threads_running');
show status WHERE variable_name in ('table_locks_immediate','table_locks_waited');
SHOW GLOBAL STATUS LIKE 'Innodb_row_lock_%';
show variables like 'key_buffer_size';show global status like 'key_read%';key_cache_miss_rate = Key_reads Key_read_requests * 100%
show global status like 'key_blocks_u%';Key_blocks_used (Key_blocks_unused + Key_blocks_used) * 100% (理想值 ≈ 80%)
show global status like 'open%tables%';show variables like 'table_open_cache';Open_tables Opened_tables 理想值 (>= 85%)Open_tables / table_open_cache 理想值 (<= 95%)
show global status like 'qcache%';
show variables like 'tmp_table_size';show variables where Variable_name in ('tmp_table_size', 'max_heap_table_size');show global status like 'created_tmp%';Created_tmp_disk_tables Created_tmp_tables * 100% (理想值 < 25%)
show variables like '%sort_buffer_size%'show global status like 'sort%';
show global status like 'open_files';show variables like 'open_files_limit';Open_files open_files_limit 理想值<= 75%
SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_reads';SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_read_requests';IFRH=(1 - Innodb_buffer_pool_reads/Innodb_buffer_pool_read_requests) * 100
show status WHERE variable_name in ('slow_launch_threads','slow_queries');
show status like 'slow_launch_threads';
show status like 'slow_queries';
SHOW GLOBAL STATUS WHERE variable_name in ('Slow_queries','Questions',' Uptime ');
show variables where vairables_value in ('Select_full_join', 'Uptime')
show global status like 'handler_read%';
点击蓝字
关注我们
文章转载自浙金科技无限,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




