The myisampack and pack_isam utilities produce compressed, read-only tables. They achieve typical storage requirement reductions of 40 to 70 percent while maintaining fast record access. myisampack packs MyISAM tables and works with all column types. pack_isam packs ISAM tables and works only with tables that contain no BLOB or TEXT columns.
myisampack and pack_isam are generally available as of MySQL 3.23.19, the first version released under the GNU General Public License (GPL). Prior to that, they are available to support customers only, so it's to your advantage to use a version of MySQL at least as recent as 3.23.19.
No special version of MySQL is needed to read tables that have been packed with these utilities. This makes them especially applicable for applications for which you want to distribute a table containing archival or encyclopedic information that is read-only and need not be updated. For example, if you are setting up a CD-ROM for an application that uses the embedded server, you'll be able to pack more data on the disk by using compressed MyISAM tables.
If you want to convert a packed file back to unpacked and modifiable form, you can do so by using myisamchk --unpack (for MyISAM tables) or isamchk --unpack (for ISAM tables).
myisampack and pack_isam pack data files, but do not touch index files. You must update the indexes by running myisamchk --recover --quick after running myisampack or isamchk --recover --quick after running pack_isam.
myisampack [options] tbl_name ... pack_isam [options] tbl_name ...
A tbl_name argument can be either the name of a table or the name of the index file for the table (a .MYI file for MyISAM tables or an .ISM file for ISAM tables). The name must include the pathname to the directory in which the table is located if you are not in that directory.
--character-sets-dir --help --verbose --debug --silent --version
--character-sets-dir is supported only by myisampack, and only as of MySQL 3.23.33.
Make a backup of the data file for each tbl_name argument as tbl_name.OLD before packing it.
Force a table to be packed even if the resulting packed file is larger than the original or if a temporary file for the table already exists. Normally, myisampack or pack_isam simply exit after printing an error message if they find a file named tbl_name.TMD, because that may indicate another instance of the program is already running. However, the file may also exist if you killed a previous invocation of the program while it was running, in which case the file can be removed safely. If you know that to be the case, use --force to tell either utility to pack the table even if the temporary file exists. (Alternatively, you can remove the temporary file manually.)
--join=join_tbl, -j join_tbl
Join (merges) all the tables named on the command line into a single packed table named join_tbl. All the tables to be merged must have the same structure. (Column names, types, and indexes must be identical.)
Run in test mode. A packing test is run, and information is printed about the results you would obtain if you actually packed the table.
--tmpdir=dir_name, -T dir_name
The pathname of the directory to use for temporary files.
--wait, -w (boolean)
Wait and retry if a table is in use. (You should not pack a table if it might be updated while you're packing it.)
Although there are no options specific to myisampack, there is one specific to pack_isam.
--packlength=n, -p n
Use a record length storage size of n bytes, where n is an integer from 1 to 3. pack_isam automatically attempts to determine the number of bytes needed to record the length of each record in the packed table. In some cases, it may determine that a smaller length could have been used. If so, pack_isam issues a message to that effect. You can run pack_isam again and explicitly specify the smaller length with a --packlength option to achieve some additional space savings.