码迷,mamicode.com
首页 > 数据库 > 详细

mysql 性能优化常用工具

时间:2016-11-07 20:13:11      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:mysql   监控   性能优化   


mysql 性能优化常用工具:


常用性能检测工具

show engine innodb  status

show full processlist  

information_schema.processlist

explain  

create table innodb_table_monitor(a int) engine=innodb;

innodb_locks

innodb_lock_wait

innodb_trx

zabbix监控

pt-tools 工具



性能优化的两种方式:

1.执行计划的解读

mysql> explain    select * from mysql.user  ;
+----+-------------+-------+------+---------------+------+---------+------+------+-------+
| id | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+------+-------+
|  1 | SIMPLE      | user  | ALL  | NULL          | NULL | NULL    | NULL |   11 | NULL  |
+----+-------------+-------+------+---------------+------+---------+------+------+-------+

explain:重要的列解释:

select_type:查询类型

(

simple:简单的查询,没有union,子查询。

primary:外面的select,在有子查询的语句中,最外面的select查询就是primary

)


type:访问类型,表的访问方式

(

const/system:唯一键查找或者主键查找(=)

ref:非唯一索引(=)

range:范围查找,>,<,>=,<=,like ‘dddd%‘,in(‘‘,‘‘),between and

eq_ref:两表连接时,右边表的连接字段是唯一键或者主键时出现此访问方式

index:全索引扫描

all:全表扫描

)


ref:进行索引比较的列或者常量

rows:这个数表示mysql要遍历多少数据才能找到,在innodb上是不准确的。


Extra:

(Using where,Using temporary,Using filesort,

Using index,

Using join buffer,

Impossible where)

explain相关解释

http://www.cnblogs.com/linjiqin/p/4125898.html




本文出自 “SQLServer MySQL” 博客,请务必保留此出处http://dwchaoyue.blog.51cto.com/2826417/1870212

mysql 性能优化常用工具

标签:mysql   监控   性能优化   

原文地址:http://dwchaoyue.blog.51cto.com/2826417/1870212

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!