myisampack

myisampack is a tool for compressing MyISAM tables. The resulting tables are read-only, and usually about 40% to 70% smaller. It is run as follows:

myisampack [options] file_name [file_name2...]

The file_name is the .MYI index file. The extension can be omitted, although keeping it permits wildcards, such as:

myisampack *.MYI

...to compress all the files.

myisampack compresses each column separately, and, when the resulting data is read, only the individual rows and columns required need to be decompressed, allowing for quicker reading.

Once a table has been packed, use myisamchk -rq (the quick and recover options) to rebuild its indexes.

myisampack does not support partitioned tables.

Do not run myisampack if the tables could be updated during the operation, and skip_external_locking has been set.

Options

The following variables can be set while passed as commandline options to myisampack, or set with a [myisampack] section in your my.cnf file.

OptionDescription
-b, --backupMake a backup of the table as table_name.OLD.
--character-sets-dir=nameDirectory where character sets are.
-# , --debug[=name]Output debug log. Often this is 'd:t:o,filename'.
-f, --forceForce packing of table even if it gets bigger or if tempfile exists.
-j, --join=nameJoin all given tables into 'new_table_name'. All tables must have identical layouts.
-?, --helpDisplay help and exit.
-s, --silentOnly write output when an error occurs
-T, --tmpdir=nameUse temporary directory to store temporary table.
-t, --testDon't pack table, only test packing it.
-v, --verboseWrite info about progress and packing result. Use multiple -v flags for more verbosity.
-V, --versionOutput version information and exit.
-w, --waitWait and retry if table is in use.

Uncompressing

To uncompress a table compressed with myisampack, use the myisamchk -u option.

Examples

> myisampack /var/lib/mysql/test/posts
Compressing /var/lib/mysql/test/posts.MYD: (1680 records)
- Calculating statistics
- Compressing file
37.71%
> myisamchk -rq /var/lib/mysql/test/posts
- check record delete-chain
- recovering (with sort) MyISAM-table '/var/lib/mysql/test/posts'
Data records: 1680
- Fixing index 1
- Fixing index 2

See Also

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.