zoukankan      html  css  js  c++  java
  • 【MySQL】pt-query-digest数据处理并关联业务

    参考:www.percona.com/doc/percona-toolkit/2.1/pt-query-digest.htm

    通过pt-query-digest将慢日志导入数据库后在表global_query_review和global_query_review_history中语句都用整型checksum     BIGINT UNSIGNED表示。

    pt-query-digest通过anemometer查看或者直接输出文本时会发现Query ID是十六进制数,所以只要能够通过将Query ID与checksum对应便可以将分析完的慢日志与业务进行关联。

    pt-query-digest以文本输出分析结果的信息较多,通过--report-format="profile"只输出Query ID部分。同时注意最好加上--limit参数,以免输出结果不全,默认输出全部的95%或20条。

    --report-format=A           Print these sections of the query analysis
                                report (default rusage,date,hostname,files,header,
                                profile,query_report,prepared)

    例如

    pt-query-digest /data1/log/slow_query/20161202/10_204_11_*-业务名称.log --report-format="profile" --limit 500

    将上面的输出进行处理后,用Query ID转换为十进制,然后将reviewed_by更新为业务名称,可以方便使用anemometer以业务查看慢查询。

  • 相关阅读:
    单分发器
    Python 虚拟环境
    $modal
    memoization
    directive例子2
    UI-Router
    angular-translate
    directive例子1
    FileInputStream/FileOutputStream的应用
    自定义readLine
  • 原文地址:https://www.cnblogs.com/jiangxu67/p/6125839.html
Copyright © 2011-2022 走看看