mysql常用监控项_MySQL常用监控项

本文关注数据库性能优化,列举了几个重要的监控指标,包括大表大小、未建主键索引的表、数据库锁统计、缓存命中率、创建临时表比率、连接使用率、打开文件比率和表缓存使用率。通过对这些指标的分析,可以有效地评估和提升数据库的运行效率。

数据库中的大表

selecttable_schema,table_name,round((sum(DATA_LENGTH)+sum(INDEX_LENGTH))/1024/1024,2)"Size(M)" from information_schema.tables group by table_schema,table_nameorder by round((sum(DATA_LENGTH)+sum(INDEX_LENGTH))/1024/1024,2) desc limit10\G'

数据库未建主键索引的表

SELECTdistinct table_name,table_schema FROM information_schema.columns WHEREtable_schema not in ('sys','information_schema','performance_schema','mysql')AND table_name not in (select distinct table_name frominformation_schema.columns where column_key='PRI')\G"

数据库锁统计

showstatus like 'table_locks_%'\G"

数据库缓存命中率

如果Qcache_hits+Com_select<>0则为 Qcache_hits/(Qcache_hits+Com_select),否则为0

线程缓存命中率

如果Connections<>0,则为1-Threads_created/Connections,否则为0

创建磁盘存储的临时表比率

如果Created_tmp_disk_tables+Created_tmp_tables<>0,则Created_tmp_disk_tables/(Created_tmp_disk_tables+Created_tmp_tables),否则为0

连接使用率

如果max_connections<>0,则threads_connected/max_connections,否则为0

打开文件比率

如果open_files_limit<>0,则open_files/open_files_limit,否则为0,表缓存使用率如果table_open_cache<>0,则open_tables/table_open_cache,否则为0

数据库Innodb中Read命中率

showstatus like 'Innodb_buffer_pool_%'\G"

数据库全表扫描情况

showglobal status like 'handler_read%'\G"

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值