zoukankan      html  css  js  c++  java
  • mysqldumpslow的使用简介

    mysqldumpslow的使用:
    比如我们要查询按时间返回前5条日志信息,格式如下:
    mysqldumpslow -s t -t 5 /var/log/mysql/slowquery_20170303.log

    参数说明:
    -s:排序方式 按锁的时间l、返回的记录数r、查询的时间t、记录的次数c,倒序的话可以加r
    -t:查询前多少条记录
    -g:支持正则表达式,以及忽略大小写

    在这里顺便说下explain吧
    explain用来分析mysql查询结构的主要关注四个参数值:
    type、key、rows、extras
    访问类型 type: al最差,ref,eq_ref居中,null最好

    all->index->range->ref->eq_ref->const或system->null

    有无使用索引 key :key为空没有使用索引
    找到所需记录要读取的行数:rows,rows值越小越好
    extras:在什么方式下找到了所需记录,出现using filesort或using temporary表明效率低下,only index用到了索引,where used用到了where 过滤条件,impossible where 没用到索引

  • 相关阅读:
    c#剪切板操作
    eclipse mvn build error tips
    Redis Tips
    IntilliJ Idea 使用中的问题与解决方案
    mongo
    python
    SQL Relative
    sybase update
    run current vim file
    git
  • 原文地址:https://www.cnblogs.com/phpper/p/6685540.html
Copyright © 2011-2022 走看看