zoukankan      html  css  js  c++  java
  • mysqldumpslow使用说明。

    mysql慢查询日志分析工具mysqldumpslow。

    常用的方法:

    mysqldumpslow -s c -t 10 /var/run/mysqld/mysqld-slow.log # 取出使用最多的10条慢查询 
    
    mysqldumpslow -s t -t 3 /var/run/mysqld/mysqld-slow.log # 取出查询时间最慢的3条慢查询
    
    mysqldumpslow -s t -t 10 -g “left join” /database/mysql/slow-log # 得到按照时间排序的前10条里面含有左连接的查询语句
    
    mysqldumpslow -s r -t 10 -g 'left join' /var/run/mysqld/mysqld-slow.log # 按照扫描行数最多的

    使用说明:

    Usage: mysqldumpslow [ OPTS... ] [ LOGS... ]  -- 后跟参数以及log文件的绝对地址;
    
      -s            what to sort by (al, at, ar, c, l, r, t), 'at' is default  
                    al: average lock time  
                    ar: average rows sent
                    at: average query time
                    c: count 
                    l: lock time
                    r: rows sent
                    t: query time
    
      -r           reverse the sort order (largest last instead of first)
      -t NUM       just show the top n queries
      -a           don't abstract all numbers to N and strings to 'S'
      -n NUM       abstract numbers with at least n digits within names
      -g PATTERN   grep: only consider stmts that include this string
      -h HOSTNAME  hostname of db server for *-slow.log filename (can be wildcard),
                   default is '*', i.e. match all
      -i NAME      name of server instance (if using mysql.server startup script)
      -l           don't subtract lock time from total time
    
  • 相关阅读:
    VPS服务器 基本配置
    WCF 系列 → HelloWord
    ASP.NET MVC3 常用整理
    ASP.NET MVC3 过滤器 Filter
    NVelocity系列 → NVelocity配置详解
    网站安全检测 Web 安全测试工具
    ASP.NET MVC3.0 静态化实现
    CSS3的动画泡沫按钮
    SQL 大数据优化
    用友备份失败,超时己过期
  • 原文地址:https://www.cnblogs.com/tangchuanyang/p/6380884.html
Copyright © 2011-2022 走看看