MyISAM Table Storage Formats •Each row uses only as much space as is required. However, if a row becomes larger, it is split into as many pieces as are required, resulting in row fragmentation. For example, if you update a row with information that extends the row length, the row becomes fragmented. In this case, you may have to run OPTIMIZE TABLE  or  myisamchk -r  from time to time to improve performance. Use  myisamchk -ei to obtain table statistics. •More difficult than static-format tables to reconstruct after a crash, because rows may be fragmented into many pieces and links (fragments) may be missing. •The expected row length for dynamic-sized rows is calculated using the following expression: •Compressed tables take very little disk space. This minimizes disk usage, which is helpful when using slow disks (such as CD-ROMs). •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: •Suffix space compression. •Prefix space compression. •Numbers with a value of zero are stored using one bit. •If values in an integer column have a small range, the column is stored using the smallest possible type. For example, a  BIGINT  column (eight bytes) can be stored as a  TINYINT  column (one byte) if all its values are in the range from  -128  to  127 . •If a column has only a small set of possible values, the data type is converted to  ENUM . •A column may use any combination of the preceding compression types. •Can be used for fixed-length or dynamic-length rows. 3408 Note 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  DROP  to drop the table, and  TRUNCATE TABLE  to empty the table. Compressed tables have the following characteristics: Compressed storage format is a read-only format that is generated with the  myisampack  tool. Compressed tables can be uncompressed with  myisamchk . There is a penalty of 6 bytes for each link. A dynamic row is linked whenever an update causes an enlargement of the row. Each new link is at least 20 bytes, so the next enlargement probably goes in the same link. If not, another link is created. You can find the number of links using  myisamchk -ed . All links may be removed with  OPTIMIZE TABLE  or  myisamchk -r . 16.2.3.3 Compressed Table Characteristics 3 + ( number of columns  + 7) / 8 + ( number of char columns ) + ( packed size of numeric columns ) + ( length of strings ) + ( number of NULL columns  + 7) / 8