<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="myisampack">
      </a>
      6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045306496592">
  </a>
  <a class="indexterm" name="idm46045306495680">
  </a>
  <a class="indexterm" name="idm46045306494736">
  </a>
  <a class="indexterm" name="idm46045306493376">
  </a>
  <p>
   The
   <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
    <span class="command">
     <strong>
      myisampack
     </strong>
    </span>
   </a>
   utility compresses
   <code class="literal">
    MyISAM
   </code>
   tables.
   <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
    <span class="command">
     <strong>
      myisampack
     </strong>
    </span>
   </a>
   works by compressing each column in the table separately.
        Usually,
   <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
    <span class="command">
     <strong>
      myisampack
     </strong>
    </span>
   </a>
   packs the data file 40%
        to 70%.
  </p>
  <p>
   When the table is used later, the server reads into memory the
        information needed to decompress columns. This results in much
        better performance when accessing individual rows, because you
        only have to uncompress exactly one row.
  </p>
  <p>
   MySQL uses
   <code class="literal">
    mmap()
   </code>
   when possible to perform
        memory mapping on compressed tables. If
   <code class="literal">
    mmap()
   </code>
   does not work, MySQL falls back to
        normal read/write file operations.
  </p>
  <p>
   Please note the following:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      If the
      <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
       <span class="command">
        <strong>
         mysqld
        </strong>
       </span>
      </a>
      server was invoked with
            external locking disabled, it is not a good idea to invoke
      <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
       <span class="command">
        <strong>
         myisampack
        </strong>
       </span>
      </a>
      if the table might be updated
            by the server during the packing process. It is safest to
            compress tables with the server stopped.
     </p>
    </li>
    <li class="listitem">
     <p>
      After packing a table, it becomes read only. This is
            generally intended (such as when accessing packed tables on
            a CD).
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
       <span class="command">
        <strong>
         myisampack
        </strong>
       </span>
      </a>
      does not support partitioned
            tables.
     </p>
    </li>
   </ul>
  </div>
  <p>
   Invoke
   <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
    <span class="command">
     <strong>
      myisampack
     </strong>
    </span>
   </a>
   like this:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa85994928"><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">myisampack <span class="token punctuation">[</span><em class="replaceable">options</em><span class="token punctuation">]</span> <em class="replaceable">file_name</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
  </div>
  <p>
   Each file name argument should be the name of an index
        (
   <code class="filename">
    .MYI
   </code>
   ) file. If you are not in the database
        directory, you should specify the path name to the file. It is
        permissible to omit the
   <code class="filename">
    .MYI
   </code>
   extension.
  </p>
  <p>
   After you compress a table with
   <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
    <span class="command">
     <strong>
      myisampack
     </strong>
    </span>
   </a>
   ,
        use
   <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
    <span class="command">
     <strong>
      myisamchk -rq
     </strong>
    </span>
   </a>
   to rebuild its indexes.
   <a class="xref" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
    Section 6.6.4, “myisamchk — MyISAM Table-Maintenance Utility”
   </a>
   .
  </p>
  <p>
   <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
    <span class="command">
     <strong>
      myisampack
     </strong>
    </span>
   </a>
   supports the following options. It
        also reads option files and supports the options for processing
        them described at
   <a class="xref" href="option-file-options.html" title="6.2.2.3 Command-Line Options that Affect Option-File Handling">
    Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”
   </a>
   .
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a name="option_myisampack_help">
      </a>
      <a class="link" href="myisampack.html#option_myisampack_help">
       <code class="option">
        --help
       </code>
      </a>
      ,
      <code class="option">
       -?
      </code>
     </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="idm46045306457312">
     </a>
     <a class="indexterm" name="idm46045306455824">
     </a>
     <p>
      Display a help message and exit.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisampack_backup">
      </a>
      <a class="link" href="myisampack.html#option_myisampack_backup">
       <code class="option">
        --backup
       </code>
      </a>
      ,
      <code class="option">
       -b
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for backup">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --backup
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306445600">
     </a>
     <a class="indexterm" name="idm46045306444112">
     </a>
     <p>
      Make a backup of each table's data file using the name
      <code class="filename">
       <em class="replaceable">
        <code>
         tbl_name
        </code>
       </em>
       .OLD
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisampack_character-sets-dir">
      </a>
      <a class="link" href="myisampack.html#option_myisampack_character-sets-dir">
       <code class="option">
        --character-sets-dir=
        <em class="replaceable">
         <code>
          dir_name
         </code>
        </em>
       </code>
      </a>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for character-sets-dir">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --character-sets-dir=dir_name
          </code>
         </td>
        </tr>
        <tr>
         <th>
          Type
         </th>
         <td>
          Directory name
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306431008">
     </a>
     <a class="indexterm" name="idm46045306429504">
     </a>
     <p>
      The directory where character sets are installed. See
      <a class="xref" href="charset-configuration.html" title="12.15 Character Set Configuration">
       Section 12.15, “Character Set Configuration”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisampack_debug">
      </a>
      <a class="link" href="myisampack.html#option_myisampack_debug">
       <code class="option">
        --debug[=
        <em class="replaceable">
         <code>
          debug_options
         </code>
        </em>
        ]
       </code>
      </a>
      ,
      <code class="option">
       -#
            [
       <em class="replaceable">
        <code>
         debug_options
        </code>
       </em>
       ]
      </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[=debug_options]
          </code>
         </td>
        </tr>
        <tr>
         <th>
          Type
         </th>
         <td>
          String
         </td>
        </tr>
        <tr>
         <th>
          Default Value
         </th>
         <td>
          <code class="literal">
           d:t:o
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306413376">
     </a>
     <a class="indexterm" name="idm46045306411888">
     </a>
     <p>
      Write a debugging log. A typical
      <em class="replaceable">
       <code>
        debug_options
       </code>
      </em>
      string is
      <code class="literal">
       d:t:o,
       <em class="replaceable">
        <code>
         file_name
        </code>
       </em>
      </code>
      .
            The default is
      <code class="literal">
       d:t:o
      </code>
      .
     </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_myisampack_force">
      </a>
      <a class="link" href="myisampack.html#option_myisampack_force">
       <code class="option">
        --force
       </code>
      </a>
      ,
      <code class="option">
       -f
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for force">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --force
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306397648">
     </a>
     <a class="indexterm" name="idm46045306396160">
     </a>
     <p>
      Produce a packed table even if it becomes larger than the
            original or if the intermediate file from an earlier
            invocation of
      <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
       <span class="command">
        <strong>
         myisampack
        </strong>
       </span>
      </a>
      exists.
            (
      <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
       <span class="command">
        <strong>
         myisampack
        </strong>
       </span>
      </a>
      creates an intermediate file
            named
      <code class="filename">
       <em class="replaceable">
        <code>
         tbl_name
        </code>
       </em>
       .TMD
      </code>
      in the database directory while it compresses the table. If
            you kill
      <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
       <span class="command">
        <strong>
         myisampack
        </strong>
       </span>
      </a>
      , the
      <code class="filename">
       .TMD
      </code>
      file might not be deleted.)
            Normally,
      <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
       <span class="command">
        <strong>
         myisampack
        </strong>
       </span>
      </a>
      exits with an error
            if it finds that
      <code class="filename">
       <em class="replaceable">
        <code>
         tbl_name
        </code>
       </em>
       .TMD
      </code>
      exists. With
      <a class="link" href="myisampack.html#option_myisampack_force">
       <code class="option">
        --force
       </code>
      </a>
      ,
      <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
       <span class="command">
        <strong>
         myisampack
        </strong>
       </span>
      </a>
      packs the table anyway.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisampack_join">
      </a>
      <a class="link" href="myisampack.html#option_myisampack_join">
       <code class="option">
        --join=
        <em class="replaceable">
         <code>
          big_tbl_name
         </code>
        </em>
       </code>
      </a>
      ,
      <code class="option">
       -j
       <em class="replaceable">
        <code>
         big_tbl_name
        </code>
       </em>
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for join">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --join=big_tbl_name
          </code>
         </td>
        </tr>
        <tr>
         <th>
          Type
         </th>
         <td>
          String
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306373232">
     </a>
     <a class="indexterm" name="idm46045306371744">
     </a>
     <p>
      Join all tables named on the command line into a single
            packed table
      <em class="replaceable">
       <code>
        big_tbl_name
       </code>
      </em>
      . All
            tables that are to be combined
      <span class="emphasis">
       <em>
        must
       </em>
      </span>
      have identical structure (same column names and types, same
            indexes, and so forth).
     </p>
     <p>
      <em class="replaceable">
       <code>
        big_tbl_name
       </code>
      </em>
      must not exist prior
            to the join operation. All source tables named on the
            command line to be merged into
      <em class="replaceable">
       <code>
        big_tbl_name
       </code>
      </em>
      must exist. The
            source tables are read for the join operation but not
            modified.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisampack_silent">
      </a>
      <a class="link" href="myisampack.html#option_myisampack_silent">
       <code class="option">
        --silent
       </code>
      </a>
      ,
      <code class="option">
       -s
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for silent">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --silent
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306358960">
     </a>
     <a class="indexterm" name="idm46045306357472">
     </a>
     <p>
      Silent mode. Write output only when errors occur.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisampack_test">
      </a>
      <a class="link" href="myisampack.html#option_myisampack_test">
       <code class="option">
        --test
       </code>
      </a>
      ,
      <code class="option">
       -t
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for test">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --test
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306347392">
     </a>
     <a class="indexterm" name="idm46045306345904">
     </a>
     <p>
      Do not actually pack the table, just test packing it.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisampack_tmpdir">
      </a>
      <a class="link" href="myisampack.html#option_myisampack_tmpdir">
       <code class="option">
        --tmpdir=
        <em class="replaceable">
         <code>
          dir_name
         </code>
        </em>
       </code>
      </a>
      ,
      <code class="option">
       -T
       <em class="replaceable">
        <code>
         dir_name
        </code>
       </em>
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for tmpdir">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --tmpdir=dir_name
          </code>
         </td>
        </tr>
        <tr>
         <th>
          Type
         </th>
         <td>
          Directory name
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306333152">
     </a>
     <a class="indexterm" name="idm46045306331664">
     </a>
     <p>
      Use the named directory as the location where
      <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
       <span class="command">
        <strong>
         myisampack
        </strong>
       </span>
      </a>
      creates temporary files.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisampack_verbose">
      </a>
      <a class="link" href="myisampack.html#option_myisampack_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="idm46045306320240">
     </a>
     <a class="indexterm" name="idm46045306318752">
     </a>
     <p>
      Verbose mode. Write information about the progress of the
            packing operation and its result.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisampack_version">
      </a>
      <a class="link" href="myisampack.html#option_myisampack_version">
       <code class="option">
        --version
       </code>
      </a>
      ,
      <code class="option">
       -V
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for version">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --version
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306308560">
     </a>
     <a class="indexterm" name="idm46045306307072">
     </a>
     <p>
      Display version information and exit.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a name="option_myisampack_wait">
      </a>
      <a class="link" href="myisampack.html#option_myisampack_wait">
       <code class="option">
        --wait
       </code>
      </a>
      ,
      <code class="option">
       -w
      </code>
     </p>
     <div class="informaltable">
      <table frame="box" rules="all" summary="Properties for wait">
       <colgroup>
        <col style="width: 30%"/>
        <col style="width: 70%"/>
       </colgroup>
       <tbody>
        <tr>
         <th>
          Command-Line Format
         </th>
         <td>
          <code class="literal">
           --wait
          </code>
         </td>
        </tr>
       </tbody>
      </table>
     </div>
     <a class="indexterm" name="idm46045306297120">
     </a>
     <a class="indexterm" name="idm46045306295632">
     </a>
     <p>
      Wait and retry if the table is in use. If the
      <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
       <span class="command">
        <strong>
         mysqld
        </strong>
       </span>
      </a>
      server was invoked with external
            locking disabled, it is not a good idea to invoke
      <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
       <span class="command">
        <strong>
         myisampack
        </strong>
       </span>
      </a>
      if the table might be updated
            by the server during the packing process.
     </p>
    </li>
   </ul>
  </div>
  <a class="indexterm" name="idm46045306290784">
  </a>
  <p>
   The following sequence of commands illustrates a typical table
        compression session:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa83116259"><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"><span class="token prompt">$&gt; </span><span class="token command">ls</span> <span class="token property">-l</span> station<span class="token punctuation">.</span>*
<span class="token property">-rw-rw-r--</span>   1 jones    my         994128 Apr 17 19<span class="token punctuation">:</span>00 station<span class="token punctuation">.</span>MYD
<span class="token property">-rw-rw-r--</span>   1 jones    my          53248 Apr 17 19<span class="token punctuation">:</span>00 station<span class="token punctuation">.</span>MYI

<span class="token prompt">$&gt; </span><span class="token command">myisamchk</span> <span class="token property">-dvv</span> station

MyISAM file<span class="token punctuation">:</span>     station
Isam-version<span class="token punctuation">:</span>  2
Creation time<span class="token punctuation">:</span> 1996-03-13 10<span class="token punctuation">:</span>08<span class="token punctuation">:</span>58
Recover time<span class="token punctuation">:</span>  1997-02-02  3<span class="token punctuation">:</span>06<span class="token punctuation">:</span>43
Data records<span class="token punctuation">:</span>              1192  Deleted blocks<span class="token punctuation">:</span>              0
Datafile parts<span class="token punctuation">:</span>            1192  Deleted data<span class="token punctuation">:</span>                0
Datafile pointer <span class="token punctuation">(</span>bytes<span class="token punctuation">)</span><span class="token punctuation">:</span>     2  Keyfile pointer <span class="token punctuation">(</span>bytes<span class="token punctuation">)</span><span class="token punctuation">:</span>     2
Max datafile length<span class="token punctuation">:</span>   54657023  Max keyfile length<span class="token punctuation">:</span>   33554431
Recordlength<span class="token punctuation">:</span>               834
Record format<span class="token punctuation">:</span> Fixed length

table description<span class="token punctuation">:</span>
Key Start Len Index   Type                 Root  Blocksize    Rec/key
1   2     4   unique  unsigned long        1024       1024          1
2   32    30  multip<span class="token punctuation">.</span> text                10240       1024          1

Field Start Length Type
1     1     1
2     2     4
3     6     4
4     10    1
5     11    20
6     31    1
7     32    30
8     62    35
9     97    35
10    132   35
11    167   4
12    171   16
13    187   35
14    222   4
15    226   16
16    242   20
17    262   20
18    282   20
19    302   30
20    332   4
21    336   4
22    340   1
23    341   8
24    349   8
25    357   8
26    365   2
27    367   2
28    369   4
29    373   4
30    377   1
31    378   2
32    380   8
33    388   4
34    392   4
35    396   4
36    400   4
37    404   1
38    405   4
39    409   4
40    413   4
41    417   4
42    421   4
43    425   4
44    429   20
45    449   30
46    479   1
47    480   1
48    481   79
49    560   79
50    639   79
51    718   79
52    797   8
53    805   1
54    806   1
55    807   20
56    827   4
57    831   4

<span class="token prompt">$&gt; </span><span class="token command">myisampack</span> station<span class="token punctuation">.</span>MYI
Compressing station<span class="token punctuation">.</span>MYI<span class="token punctuation">:</span> <span class="token punctuation">(</span>1192 records<span class="token punctuation">)</span>
- Calculating statistics

normal<span class="token punctuation">:</span>     20  empty-space<span class="token punctuation">:</span>   16  empty-zero<span class="token punctuation">:</span>     12  empty-fill<span class="token punctuation">:</span>  11
pre-space<span class="token punctuation">:</span>   0  end-space<span class="token punctuation">:</span>     12  table-lookups<span class="token punctuation">:</span>   5  zero<span class="token punctuation">:</span>         7
Original trees<span class="token punctuation">:</span>  57  After join<span class="token punctuation">:</span> 17
- Compressing file
87<span class="token punctuation">.</span>14%
Remember to run myisamchk <span class="token property">-rq</span> on compressed tables

<span class="token prompt">$&gt; </span><span class="token command">myisamchk</span> <span class="token property">-rq</span> station
- check record delete-chain
- recovering <span class="token punctuation">(</span>with sort<span class="token punctuation">)</span> MyISAM-table <span class="token atrule">'station'</span>
Data records<span class="token punctuation">:</span> 1192
- Fixing index 1
- Fixing index 2

<span class="token prompt">$&gt; </span><span class="token command">mysqladmin</span> <span class="token property">-uroot</span> flush-tables

<span class="token prompt">$&gt; </span><span class="token command">ls</span> <span class="token property">-l</span> station<span class="token punctuation">.</span>*
<span class="token property">-rw-rw-r--</span>   1 jones    my         127874 Apr 17 19<span class="token punctuation">:</span>00 station<span class="token punctuation">.</span>MYD
<span class="token property">-rw-rw-r--</span>   1 jones    my          55296 Apr 17 19<span class="token punctuation">:</span>04 station<span class="token punctuation">.</span>MYI

<span class="token prompt">$&gt; </span><span class="token command">myisamchk</span> <span class="token property">-dvv</span> station

MyISAM file<span class="token punctuation">:</span>     station
Isam-version<span class="token punctuation">:</span>  2
Creation time<span class="token punctuation">:</span> 1996-03-13 10<span class="token punctuation">:</span>08<span class="token punctuation">:</span>58
Recover time<span class="token punctuation">:</span>  1997-04-17 19<span class="token punctuation">:</span>04<span class="token punctuation">:</span>26
Data records<span class="token punctuation">:</span>               1192  Deleted blocks<span class="token punctuation">:</span>              0
Datafile parts<span class="token punctuation">:</span>             1192  Deleted data<span class="token punctuation">:</span>                0
Datafile pointer <span class="token punctuation">(</span>bytes<span class="token punctuation">)</span><span class="token punctuation">:</span>      3  Keyfile pointer <span class="token punctuation">(</span>bytes<span class="token punctuation">)</span><span class="token punctuation">:</span>     1
Max datafile length<span class="token punctuation">:</span>    16777215  Max keyfile length<span class="token punctuation">:</span>     131071
Recordlength<span class="token punctuation">:</span>                834
Record format<span class="token punctuation">:</span> Compressed

table description<span class="token punctuation">:</span>
Key Start Len Index   Type                 Root  Blocksize    Rec/key
1   2     4   unique  unsigned long       10240       1024          1
2   32    30  multip<span class="token punctuation">.</span> text                54272       1024          1

Field Start Length Type                         Huff tree  Bits
1     1     1      constant                             1     0
2     2     4      zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span>                          2     9
3     6     4      no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span>                2     9
4     10    1                                           3     9
5     11    20     table-lookup                         4     0
6     31    1                                           3     9
7     32    30     no endspace<span class="token punctuation">,</span> not_always              5     9
8     62    35     no endspace<span class="token punctuation">,</span> not_always<span class="token punctuation">,</span> no empty    6     9
9     97    35     no empty                             7     9
10    132   35     no endspace<span class="token punctuation">,</span> not_always<span class="token punctuation">,</span> no empty    6     9
11    167   4      zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span>                          2     9
12    171   16     no endspace<span class="token punctuation">,</span> not_always<span class="token punctuation">,</span> no empty    5     9
13    187   35     no endspace<span class="token punctuation">,</span> not_always<span class="token punctuation">,</span> no empty    6     9
14    222   4      zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span>                          2     9
15    226   16     no endspace<span class="token punctuation">,</span> not_always<span class="token punctuation">,</span> no empty    5     9
16    242   20     no endspace<span class="token punctuation">,</span> not_always              8     9
17    262   20     no endspace<span class="token punctuation">,</span> no empty                8     9
18    282   20     no endspace<span class="token punctuation">,</span> no empty                5     9
19    302   30     no endspace<span class="token punctuation">,</span> no empty                6     9
20    332   4      always zero                          2     9
21    336   4      always zero                          2     9
22    340   1                                           3     9
23    341   8      table-lookup                         9     0
24    349   8      table-lookup                        10     0
25    357   8      always zero                          2     9
26    365   2                                           2     9
27    367   2      no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span>                2     9
28    369   4      no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span>                2     9
29    373   4      table-lookup                        11     0
30    377   1                                           3     9
31    378   2      no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span>                2     9
32    380   8      no zeros                             2     9
33    388   4      always zero                          2     9
34    392   4      table-lookup                        12     0
35    396   4      no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span>               13     9
36    400   4      no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span>                2     9
37    404   1                                           2     9
38    405   4      no zeros                             2     9
39    409   4      always zero                          2     9
40    413   4      no zeros                             2     9
41    417   4      always zero                          2     9
42    421   4      no zeros                             2     9
43    425   4      always zero                          2     9
44    429   20     no empty                             3     9
45    449   30     no empty                             3     9
46    479   1                                          14     4
47    480   1                                          14     4
48    481   79     no endspace<span class="token punctuation">,</span> no empty               15     9
49    560   79     no empty                             2     9
50    639   79     no empty                             2     9
51    718   79     no endspace                         16     9
52    797   8      no empty                             2     9
53    805   1                                          17     1
54    806   1                                           3     9
55    807   20     no empty                             3     9
56    827   4      no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>2<span class="token punctuation">)</span>                2     9
57    831   4      no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span>                2     9</code></pre>
  </div>
  <p>
   <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
    <span class="command">
     <strong>
      myisampack
     </strong>
    </span>
   </a>
   displays the following kinds of
        information:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       normal
      </code>
     </p>
     <p>
      The number of columns for which no extra packing is used.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       empty-space
      </code>
     </p>
     <p>
      The number of columns containing values that are only
            spaces. These occupy one bit.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       empty-zero
      </code>
     </p>
     <p>
      The number of columns containing values that are only binary
            zeros. These occupy one bit.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       empty-fill
      </code>
     </p>
     <p>
      The number of integer columns that do not occupy the full
            byte range of their type. These are changed to a smaller
            type. For example, a
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        BIGINT
       </code>
      </a>
      column (eight bytes) can be stored as a
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        TINYINT
       </code>
      </a>
      column (one byte) if
            all its values are in the range from
      <code class="literal">
       -128
      </code>
      to
      <code class="literal">
       127
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       pre-space
      </code>
     </p>
     <p>
      The number of decimal columns that are stored with leading
            spaces. In this case, each value contains a count for the
            number of leading spaces.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       end-space
      </code>
     </p>
     <p>
      The number of columns that have a lot of trailing spaces. In
            this case, each value contains a count for the number of
            trailing spaces.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       table-lookup
      </code>
     </p>
     <p>
      The column had only a small number of different values,
            which were converted to an
      <a class="link" href="enum.html" title="13.3.5 The ENUM Type">
       <code class="literal">
        ENUM
       </code>
      </a>
      before Huffman
            compression.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       zero
      </code>
     </p>
     <p>
      The number of columns for which all values are zero.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       Original trees
      </code>
     </p>
     <p>
      The initial number of Huffman trees.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       After join
      </code>
     </p>
     <p>
      The number of distinct Huffman trees left after joining
            trees to save some header space.
     </p>
    </li>
   </ul>
  </div>
  <p>
   After a table has been compressed, the
   <code class="literal">
    Field
   </code>
   lines displayed by
   <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
    <span class="command">
     <strong>
      myisamchk -dvv
     </strong>
    </span>
   </a>
   include
        additional information about each column:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       Type
      </code>
     </p>
     <p>
      The data type. The value may contain any of the following
            descriptors:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         <code class="literal">
          constant
         </code>
        </p>
        <p>
         All rows have the same value.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          no endspace
         </code>
        </p>
        <p>
         Do not store endspace.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          no endspace, not_always
         </code>
        </p>
        <p>
         Do not store endspace and do not do endspace compression
                for all values.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          no endspace, no empty
         </code>
        </p>
        <p>
         Do not store endspace. Do not store empty values.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          table-lookup
         </code>
        </p>
        <p>
         The column was converted to an
         <a class="link" href="enum.html" title="13.3.5 The ENUM Type">
          <code class="literal">
           ENUM
          </code>
         </a>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          zerofill(
          <em class="replaceable">
           <code>
            N
           </code>
          </em>
          )
         </code>
        </p>
        <p>
         The most significant
         <em class="replaceable">
          <code>
           N
          </code>
         </em>
         bytes
                in the value are always 0 and are not stored.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          no zeros
         </code>
        </p>
        <p>
         Do not store zeros.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          always zero
         </code>
        </p>
        <p>
         Zero values are stored using one bit.
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       Huff tree
      </code>
     </p>
     <p>
      The number of the Huffman tree associated with the column.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       Bits
      </code>
     </p>
     <p>
      The number of bits used in the Huffman tree.
     </p>
    </li>
   </ul>
  </div>
  <p>
   After you run
   <a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
    <span class="command">
     <strong>
      myisampack
     </strong>
    </span>
   </a>
   , use
   <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
    <span class="command">
     <strong>
      myisamchk
     </strong>
    </span>
   </a>
   to re-create any indexes. At this
        time, you can also sort the index blocks and create statistics
        needed for the MySQL optimizer to work more efficiently:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa25949911"><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">myisamchk <span class="token property">-rq</span> <span class="token property">--sort-index</span> <span class="token property">--analyze</span> <em class="replaceable">tbl_name</em><span class="token punctuation">.</span>MYI</code></pre>
  </div>
  <p>
   After you have installed the packed table into the MySQL
        database directory, you should execute
   <a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
    <span class="command">
     <strong>
      mysqladmin
        flush-tables
     </strong>
    </span>
   </a>
   to force
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   to
        start using the new table.
  </p>
  <p>
   To unpack a packed table, use the
   <a class="link" href="myisamchk-repair-options.html#option_myisamchk_unpack">
    <code class="option">
     --unpack
    </code>
   </a>
   option to
   <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
    <span class="command">
     <strong>
      myisamchk
     </strong>
    </span>
   </a>
   .
  </p>
 </div>
 <br/>
</div>
