[root@mysql1 mysql]# pt-query-digest log/slow.log
# 140ms user time, 100ms system time, 25.17M rss, 207.95M vsz
用户时间,系统时间,物理内存占用大小,虚拟内存占用大小
# Current date: Sun Aug 3 23:26:38 2014
# Hostname: mysql1主机名
# Files: log/slow.log分析文件名
# Overall: 1.55k total, 36 unique, 0.10 QPS, 0.15x concurrency ___________
sql总数量,唯一语句数量,QPS,并发数
# Time range: 2014-07-21 00:49:28 to 05:08:20
日志记录的时间范围
# Attribute total min max avg 95% stddev median
属性 总计 最小 最大 平均 95% 标准差 中位数
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 2265s 1s 7s 1s 2s 490ms 1s
执行时间
# Lock time 7s 0 5s 4ms 36us 143ms 9us
锁占用时间
# Rows sent 1.22k 0 222 0.80 0.99 10.19 0
发送到客户端
# Rows examine 3.00k 0 446 1.98 4.96 20.39 0
Row扫描
# Query size 115.43k 6 695 76.21 202.40 101.09 54.21
查询大小
# Profile
# Rank Query ID Response time Calls R/Call V/M Item
排名 语句的ID 响应时间 查询执行次数 平均响应时间 响应时间Variance-to-mean的比率 查询语句一部分
# ==== ================== =============== ===== ====== ===== =============
# 1 0x813031B8BBC3B329 1051.8821 46.4% 720 1.4609 0.17 COMMIT
# 2 0x9577D48F480A1260 183.6373 8.1% 126 1.4574 0.16 SELECT customer
# 3 0x10BEBFE721A275F6 161.5586 7.1% 113 1.4297 0.12 INSERT order_line
# 4 0x0C3504CBDCA1EC89 106.3225 4.7% 75 1.4176 0.15 UPDATE customer
# 5 0x6E70441DF63ACD21 85.8189 3.8% 62 1.3842 0.09 UPDATE stock
# 6 0x5E61FF668A8E8456 75.2769 3.3% 56 1.3442 0.06 SELECT stock
# 7 0x2C897D1B2E9D563A 68.8486 3.0% 49 1.4051 0.08 UPDATE customer
# 8 0x99AA0165670CE848 67.4706 3.0% 32 2.1085 0.00 ADMIN PREPARE
# 9 0x9EB8F1110813B80D 63.3972 2.8% 44 1.4408 0.12 UPDATE orders
# 10 0xA0352AA54FDD5DF2 56.9403 2.5% 45 1.2653 0.05 UPDATE order_line
# 11 0xAC3D27A4BA6A7E6E 55.9393 2.5% 38 1.4721 0.12 UPDATE customer
# 12 0x19C8068B5C1997CD 38.5803 1.7% 23 1.6774 0.26 ROLLBACK
# 13 0x8B2716B5B486F6AA 28.5146 1.3% 20 1.4257 0.06 INSERT history
# 14 0xBD195A4F9D50914F 27.0987 1.2% 19 1.4262 0.06 SELECT stock
# 15 0x0BF7CEAD5D1D2D7E 23.6905 1.0% 17 1.3936 0.16 INSERT orders
# 16 0xBDF3FABA5EEB789B 18.5804 0.8% 14 1.3272 0.11 INSERT new_orders
# 17 0xCA268962246BE19A 17.9883 0.8% 11 1.6353 0.14 INSERT stock
# 18 0xF078A9E73D7A8520 14.0415 0.6% 6 2.3402 2.21 UPDATE district
# 19 0xF172E08E3553BBD9 13.1005 0.6% 9 1.4556 0.04 SELECT customer
# MISC 0xMISC 106.7242 4.7% 72 1.4823 0.0 <17 items="">
每条查询语句的分析
# Query 1: 0.05 QPS, 0.07x concurrency, ID 0x813031B8BBC3B329 at byte 287746
QPS每秒查询数 查询并发数 语句ID 在日志文件的偏移量
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.17
# Time range: 2014-07-21 00:49:29 to 05:08:20
# Attribute pct total min max avg 95% stddev median
属性 语句占比 总计 最小 最大 平均 95% 标准差 中位数
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 46 720占这个日志的46%,执行720次
# Exec time 46 1052s 1s 4s 1s 3s 506ms 1s
# Lock time 0 0 0 0 0 0 0 0
# Rows sent 0 0 0 0 0 0 0 0
# Rows examine 0 0 0 0 0 0 0 0
# Query size 3 4.22k 6 6 6 6 0 6
# String:
# Databases tpcc10
# Hosts localhost
# Users root
# Query_time distribution
查询的执行时间分布情况图
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
commit\G
…….
# Query 19: 0.00 QPS, 0.00x concurrency, ID 0xF172E08E3553BBD9 at byte 111014
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.04
# Time range: 2014-07-21 02:14:36 to 05:03:00
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 9
# Exec time 0 13s 1s 2s 1s 2s 253ms 1s
# Lock time 0 252us 21us 34us 28us 33us 3us 27us
# Rows sent 11 147 4 42 16.33 40.45 11.44 8.91
# Rows examine 4 147 4 42 16.33 40.45 11.44 8.91
# Query size 1 1.18k 131 136 134.11 130.47 0 130.47
# String:
# Databases tpcc10
# Hosts localhost
# Users root
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `tpcc10` LIKE 'customer'\G
# SHOW CREATE TABLE `tpcc10`.`customer`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT c_balance, c_first, c_middle, c_last FROM customer WHERE c_w_id = 9 AND c_d_id = 1 AND c_last = 'ABLEESECALLY' ORDER BY c_first\G
使用方法:http://blog.csdn.net/seteor/article/details/24017913
Query-Digest-UI生成报表 :http://blog.chinaunix.net/uid-25266990-id-3405952.html
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29096438/viewspace-1844279/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29096438/viewspace-1844279/