zoukankan      html  css  js  c++  java
  • pt-query-digest结果解释

     结果解释

     

    第一部分是摘要:

    # 620ms user time, 10ms system time, 19.76M rss, 115.84M vsz

    # Current date: Wed Mar 20 16:09:35 2013

    # Hostname: srv-nc-ssh1                           

    # Files: slow.log

    # Overall: 371 total, 35 unique, 0.00 QPS, 0.05x concurrency _____________

    # Time range: 2013-03-18 14:08:55 to 2013-03-19 12:23:36

    # Attribute          total     min     max     avg     95%  stddev  median

    # ============     ======= ======= ======= ======= ======= ======= =======

    # Exec time          3959s      1s     73s     11s     37s     12s      7s

    # Lock time           246s       0     42s   663ms   204us      4s    66us

    # Rows sent         37.53M       0   6.10M 103.58k 485.50k 580.16k       0

    # Rows examine      71.32M       0   6.10M 196.86k 961.27k 607.20k       0

    # Rows affecte       1.03M       0 973.91k   2.83k    0.99  49.98k    0.99

    # Rows read         37.53M       0   6.10M 103.58k 485.50k 580.16k       0

    # Bytes sent         4.48G      14 383.55M  12.36M 101.56M  45.74M   13.83

    # Tmp tables           110       0       5    0.30    0.99    0.79       0

    # Tmp disk tbl          12       0       1    0.03       0    0.18       0

    # Tmp tbl size      21.67M       0 1009.90k  59.82k 245.21k 158.04k      0

    # Query size        71.10k      31     983  196.25  400.73  100.16  166.51

    对于第一部分摘要的解释:

    ========================================================================================================

    # 620ms user time, 10ms system time, 19.76M rss, 115.84M vsz

    该工具执行日志分析的用户时间,系统时间,物理内存占用大小,虚拟内存占用大小。

    # Hostname: srv-nc-ssh1  

    运行分析工具的主机名

    # Files: slow.log

    被分析的文件名

    # Overall: 371 total, 35 unique, 0.00 QPS, 0.05x concurrency _____________

    语句总数量 (371),唯一的语句(35),Qps, 并发数

    # Time range: 2013-03-18 14:08:55 to 2013-03-19 12:23:36

    日志记录的时间范围

    # Attribute          total     min     max     avg     95%  stddev  median

    在这些值中,最有意义的恐怕就是95%了,与中位数类似,它也是把所有值从小到大排列,位置位于95%的那个数。

    #Row sent            发送到客户端的行数

    #Query size          查询的字符大小

    ========================================================================================================

    继续看第二部分:

    # Profile

    # Rank Query ID           Response time   Calls R/Call  Apdx V/M   

    Item# ==== ================== =============== ===== ======= ==== ===== =======

    #    1 0x3BE81BF6A30F4C74 1702.9604 43.0%   182  9.3569 0.15  5.91 INSERT u_search_record

    #    2 0x861AC23E20A17B65 1490.0836 37.6%    54 27.5941 0.05 13.54 SELECT UNION t_ask_price_info t_vouch_info t_cust_book t_hn_info

    #    3 0xD43C719B4CE15C37   96.9039  2.4%    14  6.9217 0.11  1.42 SELECT u_car_info t_stas_auc_car

    #    4 0x414D67056BE15CF4   58.2516  1.5%    20  2.9126 0.40  0.56 INSERT u_auction_back_cache

    #    5 0x4A78E978D2543BCD   56.5418  1.4%     3 18.8473 0.00  3.14 SELECT t_cust_book

    #    6 0x3A12FD01A8D9DA10   52.8541  1.3%     3 17.6180 0.00  0.00 SELECT t_auction_back_cache

    #    7 0x9186BF39CBE58A0E   50.4508  1.3%     3 16.8169 0.00  0.01 SELECT t_check_result

    #    8 0x68738A978FAB0D06   42.6112  1.1%     6  7.1019 0.17  4.66 SELECT t_sys_config t_hn_info t_hn_quote_list u_car_info

    #    9 0x65EBDC4319D9955A   36.9794  0.9%     1 36.9794 0.00  0.00 INSERT SELECT t_hn_info t_hn_audit_quote

    #   10 0x5203D60E3716D608   35.1022  0.9%     5  7.0204 0.00  0.05 SELECT mina_send

    #   11 0x64C380BEB00DFB63   28.7720  0.7%    12  2.3977 0.50  0.40 SELECT u_vehicle_type

    #   12 0xCDDA52E5A6B9F0B7   27.5927  0.7%     3  9.1976 0.00  0.00 SELECT rbvehicle

    #   13 0xA5E766B81112B13A   27.5218  0.7%     4  6.8804 0.12  3.51 SELECT u_auction_back_cache

    #   14 0x597A26236611758F   26.7460  0.7%     3  8.9153 0.00  0.65 SELECT t_hn_audit_quote t_ask_price_info

    #   15 0x443D2230FC99811C   25.2928  0.6%     3  8.4309 0.00  0.00 SELECT t_hn_quote_list

    Response: 总的响应时间。
    time: 该查询在本次分析中总的时间占比。
    calls: 执行次数,即本次分析总共有多少条这种类型的查询语句。
    R/Call: 平均每次执行的响应时间。
    Item : 查询对象

    这一部分显示了最慢的十六种类型的SQL语句。

    我这里最慢的是INSERT INTO u_search_record…… 共有182条语句,虽然每次插入的数据都是不同的,但也被归于同一类型的语句了。

    第三部分最重要了。

    以排名第一的SQL为例

    # Query 1: 0.00 QPS, 0.02x concurrency, ID 0x3BE81BF6A30F4C74 at byte 121216

    # This item is included in the report because it matches --limit.

    # Scores: Apdex = 0.15 [1.0], V/M = 5.91

    # Query_time sparkline: |    

    # Time range: 2013-03-18 15:53:08 to 2013-03-19 12:23:36

    # Attribute    pct   total     min     max     avg     95%  stddev  median

    # ============ === ======= ======= ======= ======= ======= ======= =======

    # Count         49     182

    # Exec time     43   1703s      1s     42s      9s     21s      7s      8s

    # Lock time      0    12ms    41us   133us    64us    84us    15us    60us

    # Rows sent      0       0       0       0       0       0       0       0

    # Rows examine   0       0       0       0       0       0       0       0

    # Rows affecte   0     182       1       1       1       1       0       1

    # Rows read      0       0       0       0       0       0       0       0

    # Bytes sent     0   2.49k      14      14      14      14       0      14

    # Tmp tables     0       0       0       0       0       0       0       0

    # Tmp disk tbl   0       0       0       0       0       0       0       0

    # Tmp tbl size   0       0       0       0       0       0       0       0

    # Query size    44  31.47k     166     291  177.04  192.76   24.93  158.58

    # String:

    # Databases    xinche

    # Hosts

    # InnoDB trxID 855383 (1/0%), 85538E (1/0%), 855391 (1/0%)... 179 more

    # Last errno   0

    # Users        carsingweb

    # Query_time distribution

    # 1us

    # 10us

    # 100us

    # 1ms

    # 10ms

    # 100ms

    #  1s   #################################################################  

    #  10s+ #############################################

    # Tables

    # SHOW TABLE STATUS FROM `xinche` LIKE 'u_search_record'G#    SHOW CREATE TABLE `xinche`.`u_search_record`G

    insert into u_search_record (ip, uri, params, create_date) values ('127.0.0.1', '/car/car!ajaxGetCarInfo.action', '[{"carinfo.id":["91202"]}]', '2013-03-18 17:17:08')G

    从上面可以看出,共有182条语句 

    [95%]Exec time是21s,时间长得比较离谱了 

    数据库为xinche,用户名为carsingweb 

    然后是query time的分布图,这个图太恶心了,不过也可以看得出来大部分是处于1-10s之间的, 还有

    一些超过10秒了。

    最后是几条SQL语句, 是pt-query-digest生成的,这些语句有助于分析问题。

  • 相关阅读:
    OAuth2.0认证和授权原理
    APNs详细使用步骤
    解决IDEA因分配内存而引起的卡顿
    JAVA 第二周学习总结
    JAVA 第一周学习总结
    Mac OS 上配置java开发环境
    【DP】【单调队列】洛谷 P2216 [HAOI2007]理想的正方形 题解
    【DP】【构造】NOIp模拟题 演讲 题解
    【2-SAT】【并查集】NOIp模拟题 植树方案 题解
    【字符串】【hash】【倍增】洛谷 P3502 [POI2010]CHO-Hamsters 题解
  • 原文地址:https://www.cnblogs.com/l10n/p/12606754.html
Copyright © 2011-2022 走看看