1
.\" Title: \fBmyisampack\fR
3
.\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/>
5
.\" Manual: MySQL Database System
8
.TH "\fBMYISAMPACK\fR" "1" "01/09/2007" "MySQL 5.0" "MySQL Database System"
9
.\" disable hyphenation
11
.\" disable justification (adjust text to left margin only)
14
myisampack \- generate compressed, read\-only MyISAM tables
17
\fBmyisampack [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIfile_name\fR\fR\fB ...\fR
26
works by compressing each column in the table separately. Usually,
28
packs the data file 40%\-70%.
30
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.
34
when possible to perform memory mapping on compressed tables. If
36
does not work, MySQL falls back to normal read/write file operations.
38
Please note the following:
43
server was invoked with external locking disabled, it is not a good idea to invoke
45
if the table might be updated by the server during the packing process. It is safest to compress tables with the server stopped.
48
After packing a table, it becomes read\-only. This is generally intended (such as when accessing packed tables on a CD). Allowing writes to a packed table is on our TODO list, but with low priority.
60
tables did not have this capability.)
70
shell> \fBmyisampack [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIfile_name\fR\fR\fB ...\fR
74
Each filename argument should be the name of an index (\fI.MYI\fR) file. If you are not in the database directory, you should specify the pathname to the file. It is permissible to omit the
78
After you compress a table with
79
\fBmyisampack\fR, you should use
81
to rebuild its indexes.
85
supports the following options:
91
Display a help message and exit.
97
Make a backup of each table's data file using the name
98
\fI\fItbl_name\fR\fR\fI.OLD\fR.
101
\fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR
103
The directory where character sets are installed. See
104
Section\ 9.1, \(lqThe Character Set Used for Data and Sorting\(rq.
107
\fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR,
108
\fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR
110
Write a debugging log. The
113
\'d:t:o,\fIfile_name\fR'.
119
Produce a packed table even if it becomes larger than the original or if the intermediate file from an earlier invocation of
121
exists. (\fBmyisampack\fR
122
creates an intermediate file named
123
\fI\fItbl_name\fR\fR\fI.TMD\fR
124
in the database directory while it compresses the table. If you kill
125
\fBmyisampack\fR, the
127
file might not be deleted.) Normally,
129
exits with an error if it finds that
130
\fI\fItbl_name\fR\fR\fI.TMD\fR
134
packs the table anyway.
137
\fB\-\-join=\fR\fB\fIbig_tbl_name\fR\fR,
138
\fB\-j \fR\fB\fIbig_tbl_name\fR\fR
140
Join all tables named on the command line into a single table
141
\fIbig_tbl_name\fR. All tables that are to be combined
143
have identical structure (same column names and types, same indexes, and so forth).
146
\fB\-\-packlength=\fR\fB\fIlen\fR\fR,
147
\fB\-p \fR\fB\fIlen\fR\fR
149
Specify the row length storage size, in bytes. The value should be 1, 2, or 3.
151
stores all rows with length pointers of 1, 2, or 3 bytes. In most normal cases,
153
can determine the correct length value before it begins packing the file, but it may notice during the packing process that it could have used a shorter length. In this case,
155
prints a note that you could use a shorter row length the next time you pack the same file.
161
Silent mode. Write output only when errors occur.
167
Do not actually pack the table, just test packing it.
170
\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR,
171
\fB\-T \fR\fB\fIpath\fR\fR
173
Use the named directory as the location where
175
creates temporary files.
181
Verbose mode. Write information about the progress of the packing operation and its result.
187
Display version information and exit.
193
Wait and retry if the table is in use. If the
195
server was invoked with external locking disabled, it is not a good idea to invoke
197
if the table might be updated by the server during the packing process.
201
The following sequence of commands illustrates a typical table compression session:
205
shell> \fBls \-l station.*\fR
206
\-rw\-rw\-r\-\- 1 monty my 994128 Apr 17 19:00 station.MYD
207
\-rw\-rw\-r\-\- 1 monty my 53248 Apr 17 19:00 station.MYI
208
\-rw\-rw\-r\-\- 1 monty my 5767 Apr 17 19:00 station.frm
209
shell> \fBmyisamchk \-dvv station\fR
212
Creation time: 1996\-03\-13 10:08:58
213
Recover time: 1997\-02\-02 3:06:43
214
Data records: 1192 Deleted blocks: 0
215
Datafile parts: 1192 Deleted data: 0
216
Datafile pointer (bytes): 2 Keyfile pointer (bytes): 2
217
Max datafile length: 54657023 Max keyfile length: 33554431
219
Record format: Fixed length
221
Key Start Len Index Type Root Blocksize Rec/key
222
1 2 4 unique unsigned long 1024 1024 1
223
2 32 30 multip. text 10240 1024 1
224
Field Start Length Type
282
shell> \fBmyisampack station.MYI\fR
283
Compressing station.MYI: (1192 records)
284
\- Calculating statistics
285
normal: 20 empty\-space: 16 empty\-zero: 12 empty\-fill: 11
286
pre\-space: 0 end\-space: 12 table\-lookups: 5 zero: 7
287
Original trees: 57 After join: 17
290
Remember to run myisamchk \-rq on compressed tables
291
shell> \fBls \-l station.*\fR
292
\-rw\-rw\-r\-\- 1 monty my 127874 Apr 17 19:00 station.MYD
293
\-rw\-rw\-r\-\- 1 monty my 55296 Apr 17 19:04 station.MYI
294
\-rw\-rw\-r\-\- 1 monty my 5767 Apr 17 19:00 station.frm
295
shell> \fBmyisamchk \-dvv station\fR
298
Creation time: 1996\-03\-13 10:08:58
299
Recover time: 1997\-04\-17 19:04:26
300
Data records: 1192 Deleted blocks: 0
301
Datafile parts: 1192 Deleted data: 0
302
Datafile pointer (bytes): 3 Keyfile pointer (bytes): 1
303
Max datafile length: 16777215 Max keyfile length: 131071
305
Record format: Compressed
307
Key Start Len Index Type Root Blocksize Rec/key
308
1 2 4 unique unsigned long 10240 1024 1
309
2 32 30 multip. text 54272 1024 1
310
Field Start Length Type Huff tree Bits
312
2 2 4 zerofill(1) 2 9
313
3 6 4 no zeros, zerofill(1) 2 9
315
5 11 20 table\-lookup 4 0
317
7 32 30 no endspace, not_always 5 9
318
8 62 35 no endspace, not_always, no empty 6 9
320
10 132 35 no endspace, not_always, no empty 6 9
321
11 167 4 zerofill(1) 2 9
322
12 171 16 no endspace, not_always, no empty 5 9
323
13 187 35 no endspace, not_always, no empty 6 9
324
14 222 4 zerofill(1) 2 9
325
15 226 16 no endspace, not_always, no empty 5 9
326
16 242 20 no endspace, not_always 8 9
327
17 262 20 no endspace, no empty 8 9
328
18 282 20 no endspace, no empty 5 9
329
19 302 30 no endspace, no empty 6 9
330
20 332 4 always zero 2 9
331
21 336 4 always zero 2 9
333
23 341 8 table\-lookup 9 0
334
24 349 8 table\-lookup 10 0
335
25 357 8 always zero 2 9
337
27 367 2 no zeros, zerofill(1) 2 9
338
28 369 4 no zeros, zerofill(1) 2 9
339
29 373 4 table\-lookup 11 0
341
31 378 2 no zeros, zerofill(1) 2 9
342
32 380 8 no zeros 2 9
343
33 388 4 always zero 2 9
344
34 392 4 table\-lookup 12 0
345
35 396 4 no zeros, zerofill(1) 13 9
346
36 400 4 no zeros, zerofill(1) 2 9
348
38 405 4 no zeros 2 9
349
39 409 4 always zero 2 9
350
40 413 4 no zeros 2 9
351
41 417 4 always zero 2 9
352
42 421 4 no zeros 2 9
353
43 425 4 always zero 2 9
354
44 429 20 no empty 3 9
355
45 449 30 no empty 3 9
358
48 481 79 no endspace, no empty 15 9
359
49 560 79 no empty 2 9
360
50 639 79 no empty 2 9
361
51 718 79 no endspace 16 9
362
52 797 8 no empty 2 9
365
55 807 20 no empty 3 9
366
56 827 4 no zeros, zerofill(2) 2 9
367
57 831 4 no zeros, zerofill(1) 2 9
372
displays the following kinds of information:
377
The number of columns for which no extra packing is used.
382
The number of columns containing values that are only spaces. These occupy one bit.
387
The number of columns containing values that are only binary zeros. These occupy one bit.
392
The number of integer columns that do not occupy the full byte range of their type. These are changed to a smaller type. For example, a
394
column (eight bytes) can be stored as a
396
column (one byte) if all its values are in the range from
404
The number of decimal columns that are stored with leading spaces. In this case, each value contains a count for the number of leading spaces.
409
The number of columns that have a lot of trailing spaces. In this case, each value contains a count for the number of trailing spaces.
414
The column had only a small number of different values, which were converted to an
416
before Huffman compression.
421
The number of columns for which all values are zero.
426
The initial number of Huffman trees.
431
The number of distinct Huffman trees left after joining trees to save some header space.
435
After a table has been compressed,
436
\fBmyisamchk \-dvv\fR
437
prints additional information about each column:
442
The data type. The value may contain any of the following descriptors:
448
All rows have the same value.
453
Do not store endspace.
456
no endspace, not_always
458
Do not store endspace and do not do endspace compression for all values.
461
no endspace, no empty
463
Do not store endspace. Do not store empty values.
468
The column was converted to an
476
bytes in the value are always 0 and are not stored.
486
Zero values are stored using one bit.
492
The number of the Huffman tree associated with the column.
497
The number of bits used in the Huffman tree.
502
\fBmyisampack\fR, you must run
504
to re\-create any indexes. At this time, you can also sort the index blocks and create statistics needed for the MySQL optimizer to work more efficiently:
508
shell> \fBmyisamchk \-rq \-\-sort\-index \-\-analyze \fR\fB\fItbl_name\fR\fR\fB.MYI\fR
512
After you have installed the packed table into the MySQL database directory, you should execute
513
\fBmysqladmin flush\-tables\fR
516
to start using the new table.
518
To unpack a packed table, use the
524
Copyright 1997\-2006 MySQL AB
526
This documentation is NOT distributed under a GPL license. Use of this documentation is subject to the following terms: You may create a printed copy of this documentation solely for your own personal use. Conversion to other formats is allowed as long as the actual content is not altered or edited in any way. You shall not publish or distribute this documentation in any form or on any media, except if you distribute the documentation in a manner similar to how MySQL disseminates it (that is, electronically for download on a Web site with the software) or on a CD\-ROM or similar medium, provided however that the documentation is disseminated together with the software on the same medium. Any other use, such as any dissemination of printed copies or use of this documentation, in whole or in part, in another publication, requires the prior written consent from an authorized representative of MySQL AB. MySQL AB reserves any and all rights to this documentation not expressly granted above.
530
for more information.
533
my_print_defaults(1),
540
mysql_explain_log(1),
541
mysql_fix_privilege_tables(1),
542
mysql_tzinfo_to_sql(1),
561
For more information, please refer to the MySQL Reference Manual,
562
which may already be installed locally and which is also available
563
online at http://dev.mysql.com/doc/.
565
MySQL AB (http://www.mysql.com/).
566
This software comes with no warranty.