MYISAMPACK(1)
πΈ NAME πΈ
so bestie, this is myisampack β the utility from the MYISAMPACK(1) manual β and she does exactly one thing: generate compressed, read-only MyISAM tables. periodt. π
β¨ SYNOPSIS β¨
here's the vibe check on how you call her:
myisampack [options] file_name ...
π DESCRIPTION π
okay so the myisampack utility compresses MyISAM tables. she works by compressing each column in the table separately. usually, myisampack packs the data file 40%β70%. that's a glow-up fr fr. β¨
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. the way that works is lowkey genius. π§
MariaDB uses mmap() when possible to perform memory mapping on compressed tables. if mmap() does not work, MariaDB falls back to normal read/write file operations. no cap.
please note the following:
- if the
mariadbdserver was invoked with external locking disabled, it is not a good idea to invokemyisampackif the table might be updated by the server during the packing process. it is safest to compress tables with the server stopped. π - after packing a table, it becomes read only. this is generally intended (such as when accessing packed tables on a CD). so don't come for her, she's doing what she's supposed to. π
invoke myisampack like this:
shell> myisampack [options] file_name ...
each file name argument should be the name of an index (.MYI) file. if you are not in the database directory, you should specify the path name to the file. it is permissible to omit the .MYI extension. iykyk.
after you compress a table with myisampack, you should use myisamchk -rq to rebuild its indexes. myisamchk(1). don't skip this step bestie, it's giving necessary. π
myisampack supports the following options. it also reads option files and supports the options for processing them described at Section 4.2.3.3.1, βCommand-Line Options that Affect Option-File Handlingβ. so many options, so little time. π
--help,-?β display a help message and exit. when you're lost, she's got you. π«Ά--backup,-bβ make a backup of each table's data file using the nametbl_name.OLD. safety first, bestie. π--character-sets-dir=pathβ the directory where character sets are installed. see Section 9.5, βCharacter Set Configurationβ. she needs to know where the vibes live. π--debug[=debug_options],-# [debug_options]β write a debugging log. a typicaldebug_optionsstring is'd:t:o,file_name'. the default is'd:t:o'. for when you need to see behind the scenes. π₯--force,-fβ produce a packed table even if it becomes larger than the original or if the intermediate file from an earlier invocation ofmyisampackexists. (myisampackcreates an intermediate file namedtbl_name.TMDin the database directory while it compresses the table. if you killmyisampack, the.TMDfile might not be deleted.) normally,myisampackexits with an error if it finds thattbl_name.TMDexists. with--force,myisampackpacks the table anyway. she's stubborn, but make it fashion. π--join=big_tbl_name,-j big_tbl_nameβ join all tables named on the command line into a single packed tablebig_tbl_name. all tables that are to be combined must have identical structure (same column names and types, same indexes, and so forth).big_tbl_namemust not exist prior to the join operation. all source tables named on the command line to be merged intobig_tbl_namemust exist. the source tables are read for the join operation but not modified. the join operation does not create a.frmfile forbig_tbl_name, so after the join operation finishes, copy the.frmfile from one of the source tables and name itbig_tbl_name.frm. it's giving merge, but make it manual. π§--silent,-sβ silent mode. write output only when errors occur. she's quiet, but she's listening. π€«--test,-tβ do not actually pack the table, just test packing it. a little dress rehearsal, no commitment. π--tmpdir=path,-T pathβ use the named directory as the location wheremyisampackcreates temporary files. keep it tidy. β¨--verbose,-vβ verbose mode. write information about the progress of the packing operation and its result. she's telling you everything, and honestly? we love a transparent queen. π--version,-Vβ display version information and exit. know your era. π--wait,-wβ wait and retry if the table is in use. if themariadbdserver was invoked with external locking disabled, it is not a good idea to invokemyisampackif the table might be updated by the server during the packing process. patience is a virtue, but also, maybe just stop the server. π
the following sequence of commands illustrates a typical table compression session:
...so like, here's the receipts bestie π
first we clock the files, then we peek inside station:
shell> ls -l station.*
-rw-rw-r-- 1 monty my 994128 Apr 17 19:00 station.MYD
-rw-rw-r-- 1 monty my 53248 Apr 17 19:00 station.MYI
-rw-rw-r-- 1 monty my 5767 Apr 17 19:00 station.frm
shell> myisamchk -dvv station
MyISAM file: station
Isam-version: 2
Creation time: 1996-03-13 10:08:58
Recover time: 1997-02-02 3:06:43
Data records: 1192 Deleted blocks: 0
Datafile parts: 1192 Deleted data: 0
Datafile pointer (bytes): 2 Keyfile pointer (bytes): 2
Max datafile length: 54657023 Max keyfile length: 33554431
Recordlength: 834
Record format: Fixed length
table description:
Key Start Len Index Type Root Blocksize Rec/key
1 2 4 unique unsigned long 1024 1024 1
2 32 30 multip. 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
and then the actual glow-up β¨
shell> myisampack station.MYI
Compressing station.MYI: (1192 records)
- Calculating statistics
normal: 20 empty-space: 16 empty-zero: 12 empty-fill: 11
pre-space: 0 end-space: 12 table-lookups: 5 zero: 7
Original trees: 57 After join: 17
- Compressing file
87.14%
Remember to run myisamchk -rq on compressed tables
shell> ls -l station.*
-rw-rw-r-- 1 monty my 127874 Apr 17 19:00 station.MYD
-rw-rw-r-- 1 monty my 55296 Apr 17 19:04 station.MYI
-rw-rw-r-- 1 monty my 5767 Apr 17 19:00 station.frm
shell> myisamchk -dvv station
MyISAM file: station
Isam-version: 2
Creation time: 1996-03-13 10:08:58
Recover time: 1997-04-17 19:04:26
Data records: 1192 Deleted blocks: 0
Datafile parts: 1192 Deleted data: 0
Datafile pointer (bytes): 3 Keyfile pointer (bytes): 1
Max datafile length: 16777215 Max keyfile length: 131071
Recordlength: 834
Record format: Compressed
table description:
Key Start Len Index Type Root Blocksize Rec/key
1 2 4 unique unsigned long 10240 1024 1
2 32 30 multip. text 54272 1024 1
Field Start Length Type Huff tree Bits
1 1 1 constant 1 0
2 2 4 zerofill(1) 2 9
3 6 4 no zeros, zerofill(1) 2 9
4 10 1 3 9
5 11 20 table-lookup 4 0
6 31 1 3 9
7 32 30 no endspace, not_always 5 9
8 62 35 no endspace, not_always, no empty 6 9
9 97 35 no empty 7 9
10 132 35 no endspace, not_always, no empty 6 9
11 167 4 zerofill(1) 2 9
12 171 16 no endspace, not_always, no empty 5 9
13 187 35 no endspace, not_always, no empty 6 9
14 222 4 zerofill(1) 2 9
15 226 16 no endspace, not_always, no empty 5 9
16 242 20 no endspace, not_always 8 9
17 262 20 no endspace, no empty 8 9
18 282 20 no endspace, no empty 5 9
19 302 30 no endspace, 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, zerofill(1) 2 9
28 369 4 no zeros, zerofill(1) 2 9
29 373 4 table-lookup 11 0
30 377 1 3 9
31 378 2 no zeros, zerofill(1) 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, zerofill(1) 13 9
36 400 4 no zeros, zerofill(1) 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, 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, zerofill(2) 2 9
57 831 4 no zeros, zerofill(1) 2 9
not Record format: Fixed length anymore bestie, it's Compressed now, and the Field section lowkey grew two whole new columns (Huff tree and Bits) like it went and got bangs π
myisampack spills the following kinds of information, and no we are not skipping a single one:
normalβ the number of columns where literally no extra packing got used. just vibing as-is.empty-spaceβ how many columns hold values that are nothing but spaces. those take up one bit. slay.empty-zeroβ how many columns hold values that are only binary zeros. also one bit each. iconic efficiency.empty-fillβ the number of integer columns that don't use the full byte range of their type, so they get swapped for a smaller type. like, aBIGINTcolumn (eight bytes) can live as aTINYINTcolumn (one byte) if every single value fits in the range from-128to127. glow-down for the win πpre-spaceβ the number of decimal columns stored with leading spaces. in that case each value carries a count of how many leading spaces it has.end-spaceβ the number of columns with a lot of trailing spaces. same deal, each value carries a count of the trailing spaces.table-lookupβ this column only had a small number of different values, so it got converted to anENUMbefore the Huffman compression happened.zeroβ the number of columns where every value is zero. all of them. zero.Original treesβ the initial number of Huffman trees.After joinβ how many distinct Huffman trees are left after joining trees together to save some header space.
once a table's been compressed, the Field lines that myisamchk -dvv shows you get extra intel about every column:
Typeβ the data type. the value can contain any of these descriptors:constantβ every single row has the same value. consistent queen.no endspaceβ do not store endspace.no endspace, not_alwaysβ do not store endspace, and do not do endspace compression for all values.no endspace, no emptyβ do not store endspace. do not store empty values.table-lookupβ the column got converted to anENUM.zerofill(N)β the most significant N bytes in the value are always0and are not stored.no zerosβ do not store zeros.always zeroβ zero values get stored using one bit.
Huff treeβ the number of the Huffman tree that's associated with the column.Bitsβ how many bits are used in the Huffman tree.
ok so mandatory homework time π after you run myisampack, you must run myisamchk to re-create any indexes. and while you're at it you can also sort the index blocks and create the statistics that the MariaDB optimizer needs to work more efficiently:
shell> myisamchk -rq --sort-index --analyze tbl_name.MYI
and once you've installed the packed table into the MariaDB database directory, you should run mariadb-admin flush-tables to force mariadbd to start using the new table. no cap.
and if you ever wanna unpack a packed table? use the--unpackoption onmyisamchk. that's it, that's the whole reversal π¦
π COPYRIGHT π
okay so legal era, bestie, we gotta give credit where credit is due π«Ά
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. that's it, that's the deal π
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. like fr fr, no promises were made, read the fine print β¨
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA or see http://www.gnu.org/licenses/.
not me reading license text for fun π but lowkey it matters, so here it is, all of it, untouched. no cap.
π SEE ALSO π
For more information, please refer to the MariaDB Documentation, available online at https://mariadb.com/docs/ β that's the mothership, the main character, the place where all the lore lives π
π AUTHOR π
MariaDB Foundation (http://www.mariadb.org/). icons. legends. the ones who wrote this whole thing so you could pack your MyISAM tables and move on with your day π
and that's a wrap on the whole page, bestie!! you made it to the end, which is giving dedication π this was MariaDB 11.8, dated 5 March 2025, and yes the manual page is literally called MYISAMPACK(1) β go forth and compress responsibly, mwah π¦β¨
π¦ where this page comes from
- alpine 3.24: mariadb-doc 11.8.9-r0 Β· GPL-2.0-only
- arch rolling: mariadb 13.0.2-2 Β· GPL-2.0-only
- arch rolling: mariadb-lts 12.3.3-2 Β· GPL-2.0-only
- centos-stream 10: mariadb11.8-server 3:11.8.8-1.el10 Β· ( GPL-2.0-only OR Apache-2.0 ) AND ( GPL-2.0-or-later OR Apache-2.0 ) AND BSD-2-Clause AND BSD-3-Clause AND CC-BY-4.0 AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ( GPL-3.0-or-later WITH Bison-exception-2.2 ) AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OpenSSL AND MIT AND OFL-1.1 AND CC0-1.0 AND PHP-3.0 AND PHP-3.01 AND zlib AND dtoa AND FSFAP AND blessing AND Info-ZIP AND Boehm-GC
- centos-stream 9: mariadb-server 3:11.8.8-1.module_el9+1370+ec5ecc2e Β· ( GPL-2.0-only OR Apache-2.0 ) AND ( GPL-2.0-or-later OR Apache-2.0 ) AND BSD-2-Clause AND BSD-3-Clause AND CC-BY-4.0 AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ( GPL-3.0-or-later WITH Bison-exception-2.2 ) AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OpenSSL AND MIT AND OFL-1.1 AND CC0-1.0 AND PHP-3.0 AND PHP-3.01 AND zlib AND dtoa AND FSFAP AND blessing AND Info-ZIP AND Boehm-GC
- debian trixie: mariadb-server 1:11.8.6-0+deb13u1 Β· GPL-2.0-only
- fedora 43: mariadb11.8-server 3:11.8.8-1.fc43 Β· ( GPL-2.0-only OR Apache-2.0 ) AND ( GPL-2.0-or-later OR Apache-2.0 ) AND BSD-2-Clause AND BSD-3-Clause AND CC-BY-4.0 AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ( GPL-3.0-or-later WITH Bison-exception-2.2 ) AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OpenSSL AND MIT AND OFL-1.1 AND CC0-1.0 AND PHP-3.0 AND PHP-3.01 AND zlib AND dtoa AND FSFAP AND blessing AND Info-ZIP AND Boehm-GC
- fedora 43: mariadb12.3-server 3:12.3.2-2.fc43 Β· ( GPL-2.0-only OR Apache-2.0 ) AND ( GPL-2.0-or-later OR Apache-2.0 ) AND BSD-2-Clause AND BSD-3-Clause AND CC-BY-4.0 AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ( GPL-3.0-or-later WITH Bison-exception-2.2 ) AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OpenSSL AND MIT AND OFL-1.1 AND CC0-1.0 AND PHP-3.0 AND PHP-3.01 AND zlib AND dtoa AND FSFAP AND blessing AND Info-ZIP AND Boehm-GC
- fedora 44: mariadb-server 3:11.8.6-2.fc44 Β· ( GPL-2.0-only OR Apache-2.0 ) AND ( GPL-2.0-or-later OR Apache-2.0 ) AND BSD-2-Clause AND BSD-3-Clause AND CC-BY-4.0 AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ( GPL-3.0-or-later WITH Bison-exception-2.2 ) AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OpenSSL AND MIT AND OFL-1.1 AND CC0-1.0 AND PHP-3.0 AND PHP-3.01 AND zlib AND dtoa AND FSFAP AND blessing AND Info-ZIP AND Boehm-GC
- fedora 44: mariadb-server 3:11.8.8-3.fc44 Β· ( GPL-2.0-only OR Apache-2.0 ) AND ( GPL-2.0-or-later OR Apache-2.0 ) AND BSD-2-Clause AND BSD-3-Clause AND CC-BY-4.0 AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ( GPL-3.0-or-later WITH Bison-exception-2.2 ) AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OpenSSL AND MIT AND OFL-1.1 AND CC0-1.0 AND PHP-3.0 AND PHP-3.01 AND zlib AND dtoa AND FSFAP AND blessing AND Info-ZIP AND Boehm-GC
- fedora 44: mariadb12.3-server 3:12.3.2-2.fc44 Β· ( GPL-2.0-only OR Apache-2.0 ) AND ( GPL-2.0-or-later OR Apache-2.0 ) AND BSD-2-Clause AND BSD-3-Clause AND CC-BY-4.0 AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ( GPL-3.0-or-later WITH Bison-exception-2.2 ) AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OpenSSL AND MIT AND OFL-1.1 AND CC0-1.0 AND PHP-3.0 AND PHP-3.01 AND zlib AND dtoa AND FSFAP AND blessing AND Info-ZIP AND Boehm-GC
- nixpkgs unstable: mariadb-server 11.8.8
- opensuse-leap 16.0: mariadb 11.8.8-160000.1.1 Β· SUSE-GPL-2.0-with-FLOSS-exception
- opensuse-leap 16.0: mariadb 11.8.8-160000.1.1 Β· SUSE-GPL-2.0-with-FLOSS-exception
- opensuse-leap 16.0: mariadb 11.8.8-160000.1.1 Β· SUSE-GPL-2.0-with-FLOSS-exception
- opensuse-leap 16.0: mariadb 11.8.8-160000.1.1 Β· SUSE-GPL-2.0-with-FLOSS-exception
- ubuntu resolute: mariadb-server 1:11.8.6-5 Β· GPL-2.0-only
- ubuntu resolute: mariadb-server 1:11.8.6-5ubuntu0.1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms