== ======= ======= ======= ======= # Count 41 26566 # Exec time 19 274452s 5s 54s 10s 12s 5s 10s # Lock time 0 24s 64us 40ms 885us 1ms 738us 839us # Rows sent 0 80.00k 0 13 3.08 4.96 1.29 2.90 # Rows examine 8 1.15G 44.73k 45.59k 45.43k 44.45k 0 44.45k # Query size 36 13.78M 542 544 543.73 537.02 0 537.02 # String: # Databases im # Hosts 10.100.252.38 (13301/50%)... 1 more # Users im # Query_time distribution # 1us # 10us # 100us # 1ms # 10ms # 100ms # 1s ######################################################## # 10s+ ################################################################ # Tables # SHOW TABLE STATUS FROM `im` LIKE 'gg_token'\G # SHOW CREATE TABLE `im`.`gg_token`\G # SHOW TABLE STATUS FROM `im` LIKE 'gg_tenant'\G # SHOW CREATE TABLE `im`.`gg_tenant`\G # EXPLAIN /*!50100 PARTITIONS*/ select token0_.token_id as token_id1_119_, token0_.tenant_id as tenant_10_119_, token0_.account as account2_119_, token0_.client_id as client_i3_119_, token0_.create_date as create_d4_119_, token0_.host as host5_119_, token0_.last_auth_date as last_aut6_119_, token0_.session_id as session_7_119_, token0_.token as token8_119_, token0_.user_id as user_id9_119_ from gg_token token0_ left outer join gg_tenant tenant1_ on token0_.tenant_id=tenant1_.tenant_id where token0_.user_id='00014806a5a95f25ab' and tenant1_.tenant_id='0001456d92804b00'\G # Query 2: 0.00 QPS, 0.02x concurrency, ID 0x816F5D9DB1BD38C7 at byte 17658778 # This item is included in the report because it matches --limit. # Scores: V/M = 314.49 # Time range: 2015-03-21 13:31:25 to 2015-07-18 15:11:32 # Attribute pct total min max avg 95% stddev median # ============ === ======= ======= ======= ======= ======= ======= ======= # Count 23 15295 # Exec time 17 246397s 5s 2498s 16s 32s 71s 11s # Lock time 51 32142s 0 2476s 2s 125us 71s 89us # Rows sent 0 0 0 0 0 0 0 0 # Rows examine 0 0 0 0 0 0 0 0 # Query size 9 3.55M 221 258 243.36 246.02 7.37 234.30 # String: # Databases im # Hosts 10.101.252.35 (7709/50%)... 3 more # Users im # Query_time distribution # 1us # 10us # 100us # 1ms # 10ms # 100ms # 1s ############################################# # 10s+ ################################################################ # Tables # SHOW TABLE STATUS FROM `im` LIKE 'gg_login_history'\G # SHOW CREATE TABLE `im`.`gg_login_history`\G INSERT INTO gg_login_history(login_history_id,username,resource,clientId,login_time,logout_time) VALUES('930e0b3e-d26b-4cc3-a02f-be0b1009744c','000148b62c6a6e290','Android','354273054207050','2015-04-13 23:04:42','2015-04-13 23:07:46')\G
最常用的使用方法:
(1)直接分析慢查询文件: pt-query-digest slow.log > slow_report.log (2)分析最近1小时内的查询: pt-query-digest --since=1h slow.log > slow_report.log (3)分析指定时间范围内的查询: pt-query-digest slow.log --since '2015-04-17 10:30:00' --until '2015-04-17 18:00:00'>slow_report.log (4)分析指含有select语句的慢查询 pt-query-digest--filter '$event->{fingerprint} =~ m/^select/i' slow.log> slow_report.log (5) 查询所有所有的全表扫描或full join的慢查询 pt-query-digest--filter '(($event->{Full_scan} || "") eq "yes") ||(($event->{Full_join} || "") eq "yes")' slow.log> slow_report.log
|