<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="mysqldumpslow">
      </a>
      6.6.10 mysqldumpslow — Summarize Slow Query Log Files
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045303261776">
  </a>
  <p>
   The MySQL slow query log contains information about queries that
        take a long time to execute (see
   <a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
    Section 7.4.5, “The Slow Query Log”
   </a>
   ).
   <a class="link" href="mysqldumpslow.html" title="6.6.10 mysqldumpslow — Summarize Slow Query Log Files">
    <span class="command">
     <strong>
      mysqldumpslow
     </strong>
    </span>
   </a>
   parses MySQL slow query log
        files and summarizes their contents.
  </p>
  <p>
   Normally,
   <a class="link" href="mysqldumpslow.html" title="6.6.10 mysqldumpslow — Summarize Slow Query Log Files">
    <span class="command">
     <strong>
      mysqldumpslow
     </strong>
    </span>
   </a>
   groups queries that
        are similar except for the particular values of number and
        string data values. It
   <span class="quote">
    “
    <span class="quote">
     abstracts
    </span>
    ”
   </span>
   these values to
   <code class="literal">
    N
   </code>
   and
   <code class="literal">
    'S'
   </code>
   when displaying
        summary output. To modify value abstracting behavior, use the
   <code class="option">
    -a
   </code>
   and
   <code class="option">
    -n
   </code>
   options.
  </p>
  <p>
   Invoke
   <a class="link" href="mysqldumpslow.html" title="6.6.10 mysqldumpslow — Summarize Slow Query Log Files">
    <span class="command">
     <strong>
      mysqldumpslow
     </strong>
    </span>
   </a>
   like this:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa24234909"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysqldumpslow <span class="token punctuation">[</span><em class="replaceable">options</em><span class="token punctuation">]</span> <span class="token punctuation">[</span><em class="replaceable">log_file</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span></code></pre>
  </div>
  <p>
   Example output with no options given:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa28154501"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">Reading mysql slow query log from /usr/local/mysql/data/mysqld84-slow<span class="token punctuation">.</span>log
Count<span class="token punctuation">:</span> 1  Time<span class="token attr-value"><span class="token punctuation">=</span>4.32s</span> <span class="token punctuation">(</span>4s<span class="token punctuation">)</span>  Lock<span class="token attr-value"><span class="token punctuation">=</span>0.00s</span> <span class="token punctuation">(</span>0s<span class="token punctuation">)</span>  Rows<span class="token attr-value"><span class="token punctuation">=</span>0.0</span> <span class="token punctuation">(</span>0<span class="token punctuation">)</span><span class="token punctuation">,</span> root<span class="token punctuation">[</span>root<span class="token punctuation">]</span>@localhost
 insert into t2 select * from t1

Count<span class="token punctuation">:</span> 3  Time<span class="token attr-value"><span class="token punctuation">=</span>2.53s</span> <span class="token punctuation">(</span>7s<span class="token punctuation">)</span>  Lock<span class="token attr-value"><span class="token punctuation">=</span>0.00s</span> <span class="token punctuation">(</span>0s<span class="token punctuation">)</span>  Rows<span class="token attr-value"><span class="token punctuation">=</span>0.0</span> <span class="token punctuation">(</span>0<span class="token punctuation">)</span><span class="token punctuation">,</span> root<span class="token punctuation">[</span>root<span class="token punctuation">]</span>@localhost
 insert into t2 select * from t1 limit N

Count<span class="token punctuation">:</span> 3  Time<span class="token attr-value"><span class="token punctuation">=</span>2.13s</span> <span class="token punctuation">(</span>6s<span class="token punctuation">)</span>  Lock<span class="token attr-value"><span class="token punctuation">=</span>0.00s</span> <span class="token punctuation">(</span>0s<span class="token punctuation">)</span>  Rows<span class="token attr-value"><span class="token punctuation">=</span>0.0</span> <span class="token punctuation">(</span>0<span class="token punctuation">)</span><span class="token punctuation">,</span> root<span class="token punctuation">[</span>root<span class="token punctuation">]</span>@localhost
 insert into t1 select * from t1</code></pre>
  </div>
  <p>
   <a class="link" href="mysqldumpslow.html" title="6.6.10 mysqldumpslow — Summarize Slow Query Log Files">
    <span class="command">
     <strong>
      mysqldumpslow
     </strong>
    </span>
   </a>
   supports the following options.
  </p>
  <div class="table">
   <a name="idm46045303246784">
   </a>
   <p class="title">
    <b>
     Table 6.21 mysqldumpslow Options
    </b>
   </p>
   <div class="table-contents">
    <table frame="box" rules="all" summary="Command-line options available for mysqldumpslow.">
     <colgroup>
      <col style="width: 35%"/>
      <col style="width: 64%"/>
     </colgroup>
     <thead>
      <tr>
       <th>
        Option Name
       </th>
       <th>
        Description
       </th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td>
        <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_abstract">
         -a
        </a>
       </td>
       <td>
        Do not abstract all numbers to N and strings to 'S'
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_abstract-numbers">
         -n
        </a>
       </td>
       <td>
        Abstract numbers with at least the specified digits
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_debug">
         --debug
        </a>
       </td>
       <td>
        Write debugging information
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_grep">
         -g
        </a>
       </td>
       <td>
        Only consider statements that match the pattern
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_help">
         --help
        </a>
       </td>
       <td>
        Display help message and exit
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_host">
         -h
        </a>
       </td>
       <td>
        Host name of the server in the log file name
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_instance">
         -i
        </a>
       </td>
       <td>
        Name of the server instance
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_lock">
         -l
        </a>
       </td>
       <td>
        Do not subtract lock time from total time
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_reverse">
         -r
        </a>
       </td>
       <td>
        Reverse the sort order
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_sort">
         -s
        </a>
       </td>
       <td>
        How to sort output
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_top">
         -t
        </a>
       </td>
       <td>
        Display only first num queries
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_verbose">
         --verbose
        </a>
       </td>
       <td>
        Verbose mode
       </td>
      </tr>
     </tbody>
    </table>
   </div>
   <div class="table-contents">
    <table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 502px;">
     <thead>
      <tr>
       <th style="width: 177.094px;">
        Option Name
       </th>
       <th style="width: 323.844px;">
        Description
       </th>
      </tr>
     </thead>
    </table>
   </div>
  </div>
  <br class="table-break"/>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a name="option_mysqldumpslow_help">
      </a>
      <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_help">
       <code class="option">
        --help
       </code>
      </a>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for help">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --help
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045303200112">
     </a>
     <a class="indexterm" name="idm46045303198624">
     </a>
     <p>
      Display a help message and exit.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysqldumpslow_abstract">
      </a>
      <code class="option">
       -a
      </code>
     </p>
     <p>
      Do not abstract all numbers to
      <code class="literal">
       N
      </code>
      and
            strings to
      <code class="literal">
       'S'
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysqldumpslow_debug">
      </a>
      <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_debug">
       <code class="option">
        --debug
       </code>
      </a>
      ,
      <code class="option">
       -d
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for debug">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --debug
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045303185168">
     </a>
     <a class="indexterm" name="idm46045303183680">
     </a>
     <p>
      Run in debug mode.
     </p>
     <p>
      This option is available only if MySQL was built using
      <a class="link" href="source-configuration-options.html#option_cmake_with_debug">
       <code class="option">
        WITH_DEBUG
       </code>
      </a>
      . MySQL release
            binaries provided by Oracle are
      <span class="emphasis">
       <em>
        not
       </em>
      </span>
      built using this option.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysqldumpslow_grep">
      </a>
      <code class="option">
       -g
       <em class="replaceable">
        <code>
         pattern
        </code>
       </em>
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for grep">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Type
         </th>
         <td>
          String
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045303172864">
     </a>
     <a class="indexterm" name="idm46045303171376">
     </a>
     <p>
      Consider only queries that match the
            (
      <span class="command">
       <strong>
        grep
       </strong>
      </span>
      -style) pattern.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysqldumpslow_host">
      </a>
      <code class="option">
       -h
       <em class="replaceable">
        <code>
         host_name
        </code>
       </em>
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for host">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Type
         </th>
         <td>
          String
         </td>
        </tr>
        <tr>
         <th>
          Default Value
         </th>
         <td>
          <code class="literal">
           *
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045303159264">
     </a>
     <a class="indexterm" name="idm46045303157776">
     </a>
     <p>
      Host name of MySQL server for
      <code class="filename">
       *-slow.log
      </code>
      file name. The value can
            contain a wildcard. The default is
      <code class="literal">
       *
      </code>
      (match all).
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysqldumpslow_instance">
      </a>
      <code class="option">
       -i
       <em class="replaceable">
        <code>
         name
        </code>
       </em>
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for instance">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Type
         </th>
         <td>
          String
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045303147344">
     </a>
     <a class="indexterm" name="idm46045303145856">
     </a>
     <p>
      Name of server instance (if using
      <a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
       <span class="command">
        <strong>
         mysql.server
        </strong>
       </span>
      </a>
      startup script).
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysqldumpslow_lock">
      </a>
      <code class="option">
       -l
      </code>
     </p>
     <a class="indexterm" name="idm46045303141104">
     </a>
     <a class="indexterm" name="idm46045303139616">
     </a>
     <p>
      Do not subtract lock time from total time.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysqldumpslow_abstract-numbers">
      </a>
      <code class="option">
       -n
       <em class="replaceable">
        <code>
         N
        </code>
       </em>
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for abstract-numbers">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Type
         </th>
         <td>
          Numeric
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045303130736">
     </a>
     <a class="indexterm" name="idm46045303129248">
     </a>
     <p>
      Abstract numbers with at least
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      digits within names.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysqldumpslow_reverse">
      </a>
      <code class="option">
       -r
      </code>
     </p>
     <a class="indexterm" name="idm46045303125264">
     </a>
     <a class="indexterm" name="idm46045303123776">
     </a>
     <p>
      Reverse the sort order.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysqldumpslow_sort">
      </a>
      <code class="option">
       -s
       <em class="replaceable">
        <code>
         sort_type
        </code>
       </em>
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for sort">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Type
         </th>
         <td>
          String
         </td>
        </tr>
        <tr>
         <th>
          Default Value
         </th>
         <td>
          <code class="literal">
           at
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045303112416">
     </a>
     <a class="indexterm" name="idm46045303110928">
     </a>
     <p>
      How to sort the output. The value of
      <em class="replaceable">
       <code>
        sort_type
       </code>
      </em>
      should be chosen from
            the following list:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         <code class="literal">
          t
         </code>
         ,
         <code class="literal">
          at
         </code>
         : Sort by
                query time or average query time
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          l
         </code>
         ,
         <code class="literal">
          al
         </code>
         : Sort by
                lock time or average lock time
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          r
         </code>
         ,
         <code class="literal">
          ar
         </code>
         : Sort by
                rows sent or average rows sent
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          c
         </code>
         : Sort by count
        </p>
       </li>
      </ul>
     </div>
     <p>
      By default,
      <a class="link" href="mysqldumpslow.html" title="6.6.10 mysqldumpslow — Summarize Slow Query Log Files">
       <span class="command">
        <strong>
         mysqldumpslow
        </strong>
       </span>
      </a>
      sorts by
            average query time (equivalent to
      <code class="option">
       -s at
      </code>
      ).
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysqldumpslow_top">
      </a>
      <code class="option">
       -t
       <em class="replaceable">
        <code>
         N
        </code>
       </em>
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for top">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Type
         </th>
         <td>
          Numeric
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045303090912">
     </a>
     <a class="indexterm" name="idm46045303089424">
     </a>
     <p>
      Display only the first
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      queries
            in the output.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_mysqldumpslow_verbose">
      </a>
      <a class="link" href="mysqldumpslow.html#option_mysqldumpslow_verbose">
       <code class="option">
        --verbose
       </code>
      </a>
      ,
      <code class="option">
       -v
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for verbose">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --verbose
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045303078944">
     </a>
     <a class="indexterm" name="idm46045303077456">
     </a>
     <p>
      Verbose mode. Print more information about what the program
            does.
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
