show status:了解各种SQL的执行频率。
格式:show [session | global] status; session表示当前连接(默认),global表示自数据库启动至今。
show status主要显示命令的说明:
Com_XXX表示每个XXX语句执行的次数如:
Com_select执行select操作的次数,一次查询只累计加1
Com_update执行update操作的次数
Com_insert执行insert操作的次数,对批量插入只算一次。
Com_delete执行delete操作的次数
只针对于InnoDB存储引擎的。
InnoDB_rows_read执行select操作的次数
InnoDB_rows_updated执行update操作的次数
InnoDB_rows_inserted执行insert操作的次数
InnoDB_rows_deleted执行delete操作的次数
其他:
connections 连接mysql的数量
Uptime 服务器已经工作的秒数
Slow_queries:慢查询的次数
常用:
1.show status like "Com_%";
2.show status like "Handler_read%"; // 查看索引使用的情况。
如果索引正在工作,Handler_read_key的值将很高,这个值代表了一个行被索引值读的次 数。
Handler_read_rnd_next的值高则意味着查询运行低效,并且应该建立索引补救。
转载于:https://blog.51cto.com/leezhxing/1261832