<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="compressed-format">
      </a>
      18.2.3.3 Compressed Table Characteristics
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045148046496">
  </a>
  <a class="indexterm" name="idm46045148045040">
  </a>
  <a class="indexterm" name="idm46045148043968">
  </a>
  <a class="indexterm" name="idm46045148042480">
  </a>
  <p>
   Compressed storage format is a read-only format that is
        generated with 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>
   tool.
        Compressed tables can be uncompressed with
   <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
    <span class="command">
     <strong>
      myisamchk
     </strong>
    </span>
   </a>
   .
  </p>
  <p>
   Compressed tables have the following characteristics:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      Compressed tables take very little disk space. This
            minimizes disk usage, which is helpful when using slow disks
            (such as CD-ROMs).
     </p>
    </li>
    <li class="listitem">
     <p>
      Each row is compressed separately, so there is very little
            access overhead. The header for a row takes up one to three
            bytes depending on the biggest row in the table. Each column
            is compressed differently. There is usually a different
            Huffman tree for each column. Some of the compression types
            are:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Suffix space compression.
        </p>
       </li>
       <li class="listitem">
        <p>
         Prefix space compression.
        </p>
       </li>
       <li class="listitem">
        <p>
         Numbers with a value of zero are stored using one bit.
        </p>
       </li>
       <li class="listitem">
        <p>
         If values in an integer column have a small range, the
                column is stored using the smallest possible 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>
         If a column has only a small set of possible values, the
                data type is converted to
         <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>
         A column may use any combination of the preceding
                compression types.
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      Can be used for fixed-length or dynamic-length rows.
     </p>
    </li>
   </ul>
  </div>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    While a compressed table is read only, and you cannot
          therefore update or add rows in the table, DDL (Data
          Definition Language) operations are still valid. For example,
          you may still use
    <code class="literal">
     DROP
    </code>
    to drop the table,
          and
    <a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
     <code class="literal">
      TRUNCATE TABLE
     </code>
    </a>
    to empty the
          table.
   </p>
  </div>
 </div>
 <br/>
</div>
