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

被折叠的 条评论
为什么被折叠?



