MYSQL常用的性能指标总结和归纳
(1) QPS(每秒Query量)
QPS = Questions(or Queries) / uptime
mysql> show global status like 'Question%';
mysql> show global status like 'uptime';
(2) TPS(每秒事务量)
TPS = (Com_commit + Com_rollback) / uptime
mysql > show global status like 'Com_commit';
mysql > show global status like 'Com_rollback';
mysql> show global status like 'uptime';
(3)key Buffer 命中率
mysql>show global status like 'key%';
key_buffer_read_hits = (1-key_reads /key_read_requests) * 100%
key_buffer_write_hits = (1-key_writes /key_write_requests) * 100%
(4)InnoDB Buffer命中率
mysql> show status like 'innodb_buffer_pool_read%';
innodb_buffer_read_hits = (1 -innodb_buffer_pool_reads / innodb_buffer_pool_read_requests) * 100%
(5)Query Cache命中率
mysql> show status like 'Qcache%';
Query_cache_hits = (Qcahce_hits /(Qcache_hits + Qcache_inserts )) * 100%;
(6)Table Cache状态量
mysql> show global status like 'open%';
比较 open_tables 与opend_tables值
(7)Thread Cache 命中率
mysql> show global status like'Thread%';
mysql> show global status like'Connections';
Thread_cache_hits = (1 - Threads_created /connections ) * 100%
(8)锁定状态
mysql> show global status like '%lock%';
Table_locks_waited/Table_locks_immediate=0.3% 如果这个比值比较大的话,说明表锁造成的阻塞比较严重
Innodb_row_lock_waits innodb行锁,太大可能是间隙锁造成的
(9)复制延时量
mysql > show slave status
查看Seconds_Behind_Master的值,如果为0,说明没有延迟
(10) Tmp Table 状况(临时表状况)
mysql > show global status like 'Created_tmp%';
Created_tmp_disk_tables/Created_tmp_tables比值最好不要超过10%,如果Created_tmp_tables值比较大,
可能是排序句子过多或者是连接句子不够优化
(11) Binlog Cache 使用状况
mysql > show global status like 'Binlog_cache%';
如果Binlog_cache_disk_use值不为0 ,可能需要调大 binlog_cache_size大小
(12) Innodb_log_waits 量
mysql > show status like'innodb_log_waits';
Innodb_log_waits值不等于0的话,表明 innodblog buffer 因为空间不足而等待
(13)open file and table
mysql> show global status like 'Open_files';
mysql> show global status like 'Open_tables';
(14) 慢查询
开启慢查询:
1).手动执行命令开启:
mysql> set global slow_query_log=on;
mysql> set global long_query_time=1;
2).编辑/etc/my.cnf,在[mysqld]域中添加:
slow_query_log= 1 # 开启慢查询
slow_query_log_file=/data/data/localhost-slow.log # 慢查询日志路径
long_query_time= 1 # 慢查询的时长
(15)全日志
查看全日志:
show global variables like 'general_log';
开启全日志:
set global general_log=on;
注意开启全日志会消耗服务器性能,一般只有在排查问题时才会短暂打开。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15498/viewspace-2143928/,如需转载,请注明出处,否则将追究法律责任。
MYSQL常用的性能指标总结和归纳的更多相关文章
- MYSQL常用的性能指标
(1) QPS(每秒Query量) QPS = Questions(or Queries) / seconds mysql > show global status like 'Questio ...
- Mysql常用数据类型归纳总结1
一直在用Mysql数据库,Mysql的数据类型也最常打交道的.但关于Mysql的一些常用数据类型了解程度仅限于一知半解,仅仅能满足满足于平时一些最简单的操作.而Mysql常用数据类型的定义以及规范理解 ...
- MySQL常用的锁机制 ----------顾名思义
悲观锁与乐观锁: 悲观锁:顾名思义,就是很悲观,每次去拿数据的时候都认为别人会修改,所以每次在拿数据的时候都会上锁,这样别人想拿这个数据就会block直到它拿到锁.传统的关系型数据库里边就用到了很多这 ...
- Mysql 常用 SQL 语句集锦
Mysql 常用 SQL 语句集锦 基础篇 //查询时间,友好提示 $sql = "select date_format(create_time, '%Y-%m-%d') as day fr ...
- MySQL常用命令和常见问题
MySQL常用命令和常见问题 --创建数据库并设置字符集 create database wip default character set utf8 collate utf8_general_ci; ...
- mysql常用基本操作
mysql常用操作 查看都有哪些库 show databases; 查看某个库的表 use 库名; show tables; 查看表的字段 desc 表名; 当前是哪个用户 select user() ...
- MySQL 常用的sql语句小结(待续)
mysql 常用的sql语句 1.查看数据库各个表中的记录数 USE information_schema; SELECT table_name,table_rows FROM tables WHER ...
- mysql常用操作语句
mysql常用操作语句 1.mysql -u root -p 2.mysql -h localhost -u root -p database_name 2.列出数据库: 1.show datab ...
- Mysql 常用 SQL 语句集锦 转载(https://gold.xitu.io/post/584e7b298d6d81005456eb53)
Mysql 常用 SQL 语句集锦 基础篇 //查询时间,友好提示 $sql = "select date_format(create_time, '%Y-%m-%d') as day fr ...
随机推荐
- sql 跨服务器查询
创建链接服务器 exec sp_addlinkedserver 'ITSV ', ' ', 'SQLOLEDB ', '远程服务器名或ip地址 ' exec sp_addlinkedsrvlogin ...
- python3实现二叉树的遍历与递归算法解析
1.二叉树的三种遍历方式 二叉树有三种遍历方式:先序遍历,中序遍历,后续遍历 即:先中后指的是访问根节点的顺序 eg:先序 根左右 中序 左根右 后序 左右根 遍历总体思路:将树分成最小 ...
- linux文件打包并发送到其他服务器
scp /data/backup/mongodump/mongodb.$DATE.tar root@192.168.1.70:/home/iscsi/mongodb/
- Lua + win 10 + vs2017的运行环境和创建cocos2dx 3.17的lua项目(亲测)
转:https://blog.csdn.net/maoye198602102339/article/details/82047920 不管用什么引擎写游戏,脚本语言是少不了要接触的! 首先,我说的 ...
- Pedestrian Attributes Recognition Paper List
Pedestrian Attributes Recognition Paper List 2018-12-22 22:08:55 [Note] you may also check the upda ...
- mysql 数据库(二)数据库的基本操作
mysql 数据库(二)数据库的基本操作 用户管理,添加权限,创建,显示,使用数据库 1 显示数据库:show databases; 默认数据库: mysql - 用户权限相关数据 test - 用于 ...
- ASP.NET Core 新建线程中使用依赖注入的问题
问题来自博问的一个提问 .net core 多线程数据保存的时候DbContext被释放 . TCPService 通过构造函数注入了 ContentService , ContentService ...
- 关于visual assist x插件不能用的解决方案
打開VS莫名其妙地彈出下面的錯誤框: "the security key for this program currently stored on your system does not ...
- 在UnrealEngine中用Custom节点实现马赛克效果
参考这位大神的Shaderhttp://blog.csdn.net/noahzuo/article/details/51316015 //input BaseUV 屏幕UV //intput Tili ...
- Codeforces Round #517 (Div. 2)
A #include<queue> #include<cstdio> #include<cstring> #include<algorithm> #de ...