~ubuntu-branches/ubuntu/trusty/mysql-5.6/trusty

« back to all changes in this revision

Viewing changes to man/myisamchk.1

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-12 11:54:27 UTC
  • Revision ID: package-import@ubuntu.com-20140212115427-oq6tfsqxl1wuwehi
Tags: upstream-5.6.15
ImportĀ upstreamĀ versionĀ 5.6.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'\" t
 
2
.\"     Title: \fBmyisamchk\fR
 
3
.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 
4
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
 
5
.\"      Date: 11/15/2013
 
6
.\"    Manual: MySQL Database System
 
7
.\"    Source: MySQL 5.6
 
8
.\"  Language: English
 
9
.\"
 
10
.TH "\FBMYISAMCHK\FR" "1" "11/15/2013" "MySQL 5\&.6" "MySQL Database System"
 
11
.\" -----------------------------------------------------------------
 
12
.\" * Define some portability stuff
 
13
.\" -----------------------------------------------------------------
 
14
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
15
.\" http://bugs.debian.org/507673
 
16
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
 
17
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
18
.ie \n(.g .ds Aq \(aq
 
19
.el       .ds Aq '
 
20
.\" -----------------------------------------------------------------
 
21
.\" * set default formatting
 
22
.\" -----------------------------------------------------------------
 
23
.\" disable hyphenation
 
24
.nh
 
25
.\" disable justification (adjust text to left margin only)
 
26
.ad l
 
27
.\" -----------------------------------------------------------------
 
28
.\" * MAIN CONTENT STARTS HERE *
 
29
.\" -----------------------------------------------------------------
 
30
.\" myisamchk
 
31
.SH "NAME"
 
32
myisamchk \- MyISAM table\-maintenance utility
 
33
.SH "SYNOPSIS"
 
34
.HP \w'\fBmyisamchk\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.\fR\ 'u
 
35
\fBmyisamchk [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.\fR
 
36
.SH "DESCRIPTION"
 
37
.PP
 
38
The
 
39
\fBmyisamchk\fR
 
40
utility gets information about your database tables or checks, repairs, or optimizes them\&.
 
41
\fBmyisamchk\fR
 
42
works with
 
43
MyISAM
 
44
tables (tables that have
 
45
\&.MYD
 
46
and
 
47
\&.MYI
 
48
files for storing data and indexes)\&.
 
49
.PP
 
50
You can also use the
 
51
CHECK TABLE
 
52
and
 
53
REPAIR TABLE
 
54
statements to check and repair
 
55
MyISAM
 
56
tables\&. See
 
57
Section\ \&13.7.2.2, \(lqCHECK TABLE Syntax\(rq, and
 
58
Section\ \&13.7.2.5, \(lqREPAIR TABLE Syntax\(rq\&.
 
59
.PP
 
60
The use of
 
61
\fBmyisamchk\fR
 
62
with partitioned tables is not supported\&.
 
63
.if n \{\
 
64
.sp
 
65
.\}
 
66
.RS 4
 
67
.it 1 an-trap
 
68
.nr an-no-space-flag 1
 
69
.nr an-break-flag 1
 
70
.br
 
71
.ps +1
 
72
\fBCaution\fR
 
73
.ps -1
 
74
.br
 
75
.PP
 
76
It is best to make a backup of a table before performing a table repair operation; under some circumstances the operation might cause data loss\&. Possible causes include but are not limited to file system errors\&.
 
77
.sp .5v
 
78
.RE
 
79
.PP
 
80
Invoke
 
81
\fBmyisamchk\fR
 
82
like this:
 
83
.sp
 
84
.if n \{\
 
85
.RS 4
 
86
.\}
 
87
.nf
 
88
shell> \fBmyisamchk [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.\fR
 
89
.fi
 
90
.if n \{\
 
91
.RE
 
92
.\}
 
93
.PP
 
94
The
 
95
\fIoptions\fR
 
96
specify what you want
 
97
\fBmyisamchk\fR
 
98
to do\&. They are described in the following sections\&. You can also get a list of options by invoking
 
99
\fBmyisamchk \-\-help\fR\&.
 
100
.PP
 
101
With no options,
 
102
\fBmyisamchk\fR
 
103
simply checks your table as the default operation\&. To get more information or to tell
 
104
\fBmyisamchk\fR
 
105
to take corrective action, specify options as described in the following discussion\&.
 
106
.PP
 
107
\fItbl_name\fR
 
108
is the database table you want to check or repair\&. If you run
 
109
\fBmyisamchk\fR
 
110
somewhere other than in the database directory, you must specify the path to the database directory, because
 
111
\fBmyisamchk\fR
 
112
has no idea where the database is located\&. In fact,
 
113
\fBmyisamchk\fR
 
114
does not actually care whether the files you are working on are located in a database directory\&. You can copy the files that correspond to a database table into some other location and perform recovery operations on them there\&.
 
115
.PP
 
116
You can name several tables on the
 
117
\fBmyisamchk\fR
 
118
command line if you wish\&. You can also specify a table by naming its index file (the file with the
 
119
\&.MYI
 
120
suffix)\&. This enables you to specify all tables in a directory by using the pattern
 
121
*\&.MYI\&. For example, if you are in a database directory, you can check all the
 
122
MyISAM
 
123
tables in that directory like this:
 
124
.sp
 
125
.if n \{\
 
126
.RS 4
 
127
.\}
 
128
.nf
 
129
shell> \fBmyisamchk *\&.MYI\fR
 
130
.fi
 
131
.if n \{\
 
132
.RE
 
133
.\}
 
134
.PP
 
135
If you are not in the database directory, you can check all the tables there by specifying the path to the directory:
 
136
.sp
 
137
.if n \{\
 
138
.RS 4
 
139
.\}
 
140
.nf
 
141
shell> \fBmyisamchk \fR\fB\fI/path/to/database_dir/\fR\fR\fB*\&.MYI\fR
 
142
.fi
 
143
.if n \{\
 
144
.RE
 
145
.\}
 
146
.PP
 
147
You can even check all tables in all databases by specifying a wildcard with the path to the MySQL data directory:
 
148
.sp
 
149
.if n \{\
 
150
.RS 4
 
151
.\}
 
152
.nf
 
153
shell> \fBmyisamchk \fR\fB\fI/path/to/datadir/*/*\fR\fR\fB\&.MYI\fR
 
154
.fi
 
155
.if n \{\
 
156
.RE
 
157
.\}
 
158
.PP
 
159
The recommended way to quickly check all
 
160
MyISAM
 
161
tables is:
 
162
.sp
 
163
.if n \{\
 
164
.RS 4
 
165
.\}
 
166
.nf
 
167
shell> \fBmyisamchk \-\-silent \-\-fast \fR\fB\fI/path/to/datadir/*/*\fR\fR\fB\&.MYI\fR
 
168
.fi
 
169
.if n \{\
 
170
.RE
 
171
.\}
 
172
.PP
 
173
If you want to check all
 
174
MyISAM
 
175
tables and repair any that are corrupted, you can use the following command:
 
176
.sp
 
177
.if n \{\
 
178
.RS 4
 
179
.\}
 
180
.nf
 
181
shell> \fBmyisamchk \-\-silent \-\-force \-\-fast \-\-update\-state \e\fR
 
182
          \fB\-\-key_buffer_size=64M \-\-myisam_sort_buffer_size=64M \e\fR
 
183
          \fB\-\-read_buffer_size=1M \-\-write_buffer_size=1M \e\fR
 
184
          \fB\fI/path/to/datadir/*/*\fR\fR\fB\&.MYI\fR
 
185
.fi
 
186
.if n \{\
 
187
.RE
 
188
.\}
 
189
.PP
 
190
This command assumes that you have more than 64MB free\&. For more information about memory allocation with
 
191
\fBmyisamchk\fR, see
 
192
the section called \(lqMYISAMCHK MEMORY USAGE\(rq\&.
 
193
.PP
 
194
For additional information about using
 
195
\fBmyisamchk\fR, see
 
196
Section\ \&7.6, \(lqMyISAM Table Maintenance and Crash Recovery\(rq\&.
 
197
.if n \{\
 
198
.sp
 
199
.\}
 
200
.RS 4
 
201
.it 1 an-trap
 
202
.nr an-no-space-flag 1
 
203
.nr an-break-flag 1
 
204
.br
 
205
.ps +1
 
206
\fBImportant\fR
 
207
.ps -1
 
208
.br
 
209
.PP
 
210
\fIYou must ensure that no other program is using the tables while you are running \fR\fI\fBmyisamchk\fR\fR\&. The most effective means of doing so is to shut down the MySQL server while running
 
211
\fBmyisamchk\fR, or to lock all tables that
 
212
\fBmyisamchk\fR
 
213
is being used on\&.
 
214
.PP
 
215
Otherwise, when you run
 
216
\fBmyisamchk\fR, it may display the following error message:
 
217
.sp
 
218
.if n \{\
 
219
.RS 4
 
220
.\}
 
221
.nf
 
222
warning: clients are using or haven\*(Aqt closed the table properly
 
223
.fi
 
224
.if n \{\
 
225
.RE
 
226
.\}
 
227
.PP
 
228
This means that you are trying to check a table that has been updated by another program (such as the
 
229
\fBmysqld\fR
 
230
server) that hasn\*(Aqt yet closed the file or that has died without closing the file properly, which can sometimes lead to the corruption of one or more
 
231
MyISAM
 
232
tables\&.
 
233
.PP
 
234
If
 
235
\fBmysqld\fR
 
236
is running, you must force it to flush any table modifications that are still buffered in memory by using
 
237
FLUSH TABLES\&. You should then ensure that no one is using the tables while you are running
 
238
\fBmyisamchk\fR
 
239
.PP
 
240
However, the easiest way to avoid this problem is to use
 
241
CHECK TABLE
 
242
instead of
 
243
\fBmyisamchk\fR
 
244
to check tables\&. See
 
245
Section\ \&13.7.2.2, \(lqCHECK TABLE Syntax\(rq\&.
 
246
.sp .5v
 
247
.RE
 
248
.PP
 
249
\fBmyisamchk\fR
 
250
supports the following options, which can be specified on the command line or in the
 
251
[myisamchk]
 
252
group of an option file\&.
 
253
\fBmyisamchk\fR
 
254
also supports the options for processing option files described at
 
255
Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&.
 
256
.SH "MYISAMCHK GENERAL OPTIONS"
 
257
.\" options: myisamchk
 
258
.\" myisamchk: options
 
259
.PP
 
260
The options described in this section can be used for any type of table maintenance operation performed by
 
261
\fBmyisamchk\fR\&. The sections following this one describe options that pertain only to specific operations, such as table checking or repairing\&.
 
262
.sp
 
263
.RS 4
 
264
.ie n \{\
 
265
\h'-04'\(bu\h'+03'\c
 
266
.\}
 
267
.el \{\
 
268
.sp -1
 
269
.IP \(bu 2.3
 
270
.\}
 
271
.\" myisamchk: help option.\" help option: myisamchk\fB\-\-help\fR,
 
272
\fB\-?\fR
 
273
.sp
 
274
Display a help message and exit\&. Options are grouped by type of operation\&.
 
275
.RE
 
276
.sp
 
277
.RS 4
 
278
.ie n \{\
 
279
\h'-04'\(bu\h'+03'\c
 
280
.\}
 
281
.el \{\
 
282
.sp -1
 
283
.IP \(bu 2.3
 
284
.\}
 
285
.\" myisamchk: HELP option.\" HELP option: myisamchk\fB\-\-HELP\fR,
 
286
\fB\-H\fR
 
287
.sp
 
288
Display a help message and exit\&. Options are presented in a single list\&.
 
289
.RE
 
290
.sp
 
291
.RS 4
 
292
.ie n \{\
 
293
\h'-04'\(bu\h'+03'\c
 
294
.\}
 
295
.el \{\
 
296
.sp -1
 
297
.IP \(bu 2.3
 
298
.\}
 
299
.\" myisamchk: debug option.\" debug option: myisamchk\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR,
 
300
\fB\-# \fR\fB\fIdebug_options\fR\fR
 
301
.sp
 
302
Write a debugging log\&. A typical
 
303
\fIdebug_options\fR
 
304
string is
 
305
\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is
 
306
\*(Aqd:t:o,/tmp/myisamchk\&.trace\*(Aq\&.
 
307
.RE
 
308
.sp
 
309
.RS 4
 
310
.ie n \{\
 
311
\h'-04'\(bu\h'+03'\c
 
312
.\}
 
313
.el \{\
 
314
.sp -1
 
315
.IP \(bu 2.3
 
316
.\}
 
317
.\" myisamchk: silent option.\" silent option: myisamchk\fB\-\-silent\fR,
 
318
\fB\-s\fR
 
319
.sp
 
320
Silent mode\&. Write output only when errors occur\&. You can use
 
321
\fB\-s\fR
 
322
twice (\fB\-ss\fR) to make
 
323
\fBmyisamchk\fR
 
324
very silent\&.
 
325
.RE
 
326
.sp
 
327
.RS 4
 
328
.ie n \{\
 
329
\h'-04'\(bu\h'+03'\c
 
330
.\}
 
331
.el \{\
 
332
.sp -1
 
333
.IP \(bu 2.3
 
334
.\}
 
335
.\" myisamchk: verbose option.\" verbose option: myisamchk\fB\-\-verbose\fR,
 
336
\fB\-v\fR
 
337
.sp
 
338
Verbose mode\&. Print more information about what the program does\&. This can be used with
 
339
\fB\-d\fR
 
340
and
 
341
\fB\-e\fR\&. Use
 
342
\fB\-v\fR
 
343
multiple times (\fB\-vv\fR,
 
344
\fB\-vvv\fR) for even more output\&.
 
345
.RE
 
346
.sp
 
347
.RS 4
 
348
.ie n \{\
 
349
\h'-04'\(bu\h'+03'\c
 
350
.\}
 
351
.el \{\
 
352
.sp -1
 
353
.IP \(bu 2.3
 
354
.\}
 
355
.\" myisamchk: version option.\" version option: myisamchk\fB\-\-version\fR,
 
356
\fB\-V\fR
 
357
.sp
 
358
Display version information and exit\&.
 
359
.RE
 
360
.sp
 
361
.RS 4
 
362
.ie n \{\
 
363
\h'-04'\(bu\h'+03'\c
 
364
.\}
 
365
.el \{\
 
366
.sp -1
 
367
.IP \(bu 2.3
 
368
.\}
 
369
.\" myisamchk: wait option.\" wait option: myisamchk\fB\-\-wait\fR,
 
370
\fB\-w\fR
 
371
.sp
 
372
Instead of terminating with an error if the table is locked, wait until the table is unlocked before continuing\&. If you are running
 
373
\fBmysqld\fR
 
374
with external locking disabled, the table can be locked only by another
 
375
\fBmyisamchk\fR
 
376
command\&.
 
377
.RE
 
378
.PP
 
379
You can also set the following variables by using
 
380
\fB\-\-\fR\fB\fIvar_name\fR\fR\fB=\fR\fB\fIvalue\fR\fR
 
381
syntax:
 
382
.\" decode_bits myisamchk variable
 
383
.\" ft_max_word_len myisamchk variable
 
384
.\" ft_min_word_len myisamchk variable
 
385
.\" ft_stopword_file myisamchk variable
 
386
.\" key_buffer_size myisamchk variable
 
387
.\" myisam_block_size myisamchk variable
 
388
.\" read_buffer_size myisamchk variable
 
389
.\" sort_buffer_size myisamchk variable
 
390
.\" myisam_sort_buffer_size myisamchk variable
 
391
.\" sort_key_blocks myisamchk variable
 
392
.\" stats_method myisamchk variable
 
393
.\" write_buffer_size myisamchk variable
 
394
.TS
 
395
allbox tab(:);
 
396
lB lB.
 
397
T{
 
398
Variable
 
399
T}:T{
 
400
Default Value
 
401
T}
 
402
.T&
 
403
l l
 
404
l l
 
405
l l
 
406
l l
 
407
l l
 
408
l l
 
409
l l
 
410
l l
 
411
l l
 
412
l l
 
413
l l
 
414
l l.
 
415
T{
 
416
decode_bits
 
417
T}:T{
 
418
9
 
419
T}
 
420
T{
 
421
ft_max_word_len
 
422
T}:T{
 
423
version\-dependent
 
424
T}
 
425
T{
 
426
ft_min_word_len
 
427
T}:T{
 
428
4
 
429
T}
 
430
T{
 
431
ft_stopword_file
 
432
T}:T{
 
433
built\-in list
 
434
T}
 
435
T{
 
436
key_buffer_size
 
437
T}:T{
 
438
523264
 
439
T}
 
440
T{
 
441
myisam_block_size
 
442
T}:T{
 
443
1024
 
444
T}
 
445
T{
 
446
myisam_sort_key_blocks
 
447
T}:T{
 
448
16
 
449
T}
 
450
T{
 
451
read_buffer_size
 
452
T}:T{
 
453
262136
 
454
T}
 
455
T{
 
456
sort_buffer_size
 
457
T}:T{
 
458
2097144
 
459
T}
 
460
T{
 
461
sort_key_blocks
 
462
T}:T{
 
463
16
 
464
T}
 
465
T{
 
466
stats_method
 
467
T}:T{
 
468
nulls_unequal
 
469
T}
 
470
T{
 
471
write_buffer_size
 
472
T}:T{
 
473
262136
 
474
T}
 
475
.TE
 
476
.sp 1
 
477
.PP
 
478
The possible
 
479
\fBmyisamchk\fR
 
480
variables and their default values can be examined with
 
481
\fBmyisamchk \-\-help\fR:
 
482
.PP
 
483
sort_buffer_size
 
484
is used when the keys are repaired by sorting keys, which is the normal case when you use
 
485
\fB\-\-recover\fR\&. As of MySQL 5\&.6\&.9,
 
486
myisam_sort_buffer_size
 
487
is available as an alternative name to
 
488
sort_buffer_size\&.
 
489
myisam_sort_buffer_size
 
490
is preferable to
 
491
sort_buffer_size
 
492
because its name corresponds to the
 
493
myisam_sort_buffer_size
 
494
server system variable that has a similar meaning\&.
 
495
sort_buffer_size
 
496
should be considered deprecated\&.
 
497
.PP
 
498
key_buffer_size
 
499
is used when you are checking the table with
 
500
\fB\-\-extend\-check\fR
 
501
or when the keys are repaired by inserting keys row by row into the table (like when doing normal inserts)\&. Repairing through the key buffer is used in the following cases:
 
502
.sp
 
503
.RS 4
 
504
.ie n \{\
 
505
\h'-04'\(bu\h'+03'\c
 
506
.\}
 
507
.el \{\
 
508
.sp -1
 
509
.IP \(bu 2.3
 
510
.\}
 
511
You use
 
512
\fB\-\-safe\-recover\fR\&.
 
513
.RE
 
514
.sp
 
515
.RS 4
 
516
.ie n \{\
 
517
\h'-04'\(bu\h'+03'\c
 
518
.\}
 
519
.el \{\
 
520
.sp -1
 
521
.IP \(bu 2.3
 
522
.\}
 
523
The temporary files needed to sort the keys would be more than twice as big as when creating the key file directly\&. This is often the case when you have large key values for
 
524
CHAR,
 
525
VARCHAR, or
 
526
TEXT
 
527
columns, because the sort operation needs to store the complete key values as it proceeds\&. If you have lots of temporary space and you can force
 
528
\fBmyisamchk\fR
 
529
to repair by sorting, you can use the
 
530
\fB\-\-sort\-recover\fR
 
531
option\&.
 
532
.RE
 
533
.PP
 
534
Repairing through the key buffer takes much less disk space than using sorting, but is also much slower\&.
 
535
.PP
 
536
If you want a faster repair, set the
 
537
key_buffer_size
 
538
and
 
539
myisam_sort_buffer_size
 
540
variables to about 25% of your available memory\&. You can set both variables to large values, because only one of them is used at a time\&.
 
541
.PP
 
542
myisam_block_size
 
543
is the size used for index blocks\&.
 
544
.PP
 
545
stats_method
 
546
influences how
 
547
NULL
 
548
values are treated for index statistics collection when the
 
549
\fB\-\-analyze\fR
 
550
option is given\&. It acts like the
 
551
myisam_stats_method
 
552
system variable\&. For more information, see the description of
 
553
myisam_stats_method
 
554
in
 
555
Section\ \&5.1.4, \(lqServer System Variables\(rq, and
 
556
Section\ \&8.3.7, \(lqInnoDB and MyISAM Index Statistics Collection\(rq\&.
 
557
.PP
 
558
ft_min_word_len
 
559
and
 
560
ft_max_word_len
 
561
indicate the minimum and maximum word length for
 
562
FULLTEXT
 
563
indexes on
 
564
MyISAM
 
565
tables\&.
 
566
ft_stopword_file
 
567
names the stopword file\&. These need to be set under the following circumstances\&.
 
568
.PP
 
569
If you use
 
570
\fBmyisamchk\fR
 
571
to perform an operation that modifies table indexes (such as repair or analyze), the
 
572
FULLTEXT
 
573
indexes are rebuilt using the default full\-text parameter values for minimum and maximum word length and the stopword file unless you specify otherwise\&. This can result in queries failing\&.
 
574
.PP
 
575
The problem occurs because these parameters are known only by the server\&. They are not stored in
 
576
MyISAM
 
577
index files\&. To avoid the problem if you have modified the minimum or maximum word length or the stopword file in the server, specify the same
 
578
ft_min_word_len,
 
579
ft_max_word_len, and
 
580
ft_stopword_file
 
581
values to
 
582
\fBmyisamchk\fR
 
583
that you use for
 
584
\fBmysqld\fR\&. For example, if you have set the minimum word length to 3, you can repair a table with
 
585
\fBmyisamchk\fR
 
586
like this:
 
587
.sp
 
588
.if n \{\
 
589
.RS 4
 
590
.\}
 
591
.nf
 
592
shell> \fBmyisamchk \-\-recover \-\-ft_min_word_len=3 \fR\fB\fItbl_name\fR\fR\fB\&.MYI\fR
 
593
.fi
 
594
.if n \{\
 
595
.RE
 
596
.\}
 
597
.PP
 
598
To ensure that
 
599
\fBmyisamchk\fR
 
600
and the server use the same values for full\-text parameters, you can place each one in both the
 
601
[mysqld]
 
602
and
 
603
[myisamchk]
 
604
sections of an option file:
 
605
.sp
 
606
.if n \{\
 
607
.RS 4
 
608
.\}
 
609
.nf
 
610
[mysqld]
 
611
ft_min_word_len=3
 
612
[myisamchk]
 
613
ft_min_word_len=3
 
614
.fi
 
615
.if n \{\
 
616
.RE
 
617
.\}
 
618
.PP
 
619
An alternative to using
 
620
\fBmyisamchk\fR
 
621
is to use the
 
622
REPAIR TABLE,
 
623
ANALYZE TABLE,
 
624
OPTIMIZE TABLE, or
 
625
ALTER TABLE\&. These statements are performed by the server, which knows the proper full\-text parameter values to use\&.
 
626
.SH "MYISAMCHK CHECK OPTIONS"
 
627
.\" check options: myisamchk
 
628
.\" tables: checking
 
629
.PP
 
630
\fBmyisamchk\fR
 
631
supports the following options for table checking operations:
 
632
.sp
 
633
.RS 4
 
634
.ie n \{\
 
635
\h'-04'\(bu\h'+03'\c
 
636
.\}
 
637
.el \{\
 
638
.sp -1
 
639
.IP \(bu 2.3
 
640
.\}
 
641
.\" myisamchk: check option.\" check option: myisamchk\fB\-\-check\fR,
 
642
\fB\-c\fR
 
643
.sp
 
644
Check the table for errors\&. This is the default operation if you specify no option that selects an operation type explicitly\&.
 
645
.RE
 
646
.sp
 
647
.RS 4
 
648
.ie n \{\
 
649
\h'-04'\(bu\h'+03'\c
 
650
.\}
 
651
.el \{\
 
652
.sp -1
 
653
.IP \(bu 2.3
 
654
.\}
 
655
.\" myisamchk: check-only-changed option.\" check-only-changed option: myisamchk\fB\-\-check\-only\-changed\fR,
 
656
\fB\-C\fR
 
657
.sp
 
658
Check only tables that have changed since the last check\&.
 
659
.RE
 
660
.sp
 
661
.RS 4
 
662
.ie n \{\
 
663
\h'-04'\(bu\h'+03'\c
 
664
.\}
 
665
.el \{\
 
666
.sp -1
 
667
.IP \(bu 2.3
 
668
.\}
 
669
.\" myisamchk: extend-check option.\" extend-check option: myisamchk\fB\-\-extend\-check\fR,
 
670
\fB\-e\fR
 
671
.sp
 
672
Check the table very thoroughly\&. This is quite slow if the table has many indexes\&. This option should only be used in extreme cases\&. Normally,
 
673
\fBmyisamchk\fR
 
674
or
 
675
\fBmyisamchk \-\-medium\-check\fR
 
676
should be able to determine whether there are any errors in the table\&.
 
677
.sp
 
678
If you are using
 
679
\fB\-\-extend\-check\fR
 
680
and have plenty of memory, setting the
 
681
key_buffer_size
 
682
variable to a large value helps the repair operation run faster\&.
 
683
.sp
 
684
See also the description of this option under table repair options\&.
 
685
.sp
 
686
For a description of the output format, see
 
687
the section called \(lqOBTAINING TABLE INFORMATION WITH MYISAMCHK\(rq\&.
 
688
.RE
 
689
.sp
 
690
.RS 4
 
691
.ie n \{\
 
692
\h'-04'\(bu\h'+03'\c
 
693
.\}
 
694
.el \{\
 
695
.sp -1
 
696
.IP \(bu 2.3
 
697
.\}
 
698
.\" myisamchk: fast option.\" fast option: myisamchk\fB\-\-fast\fR,
 
699
\fB\-F\fR
 
700
.sp
 
701
Check only tables that haven\*(Aqt been closed properly\&.
 
702
.RE
 
703
.sp
 
704
.RS 4
 
705
.ie n \{\
 
706
\h'-04'\(bu\h'+03'\c
 
707
.\}
 
708
.el \{\
 
709
.sp -1
 
710
.IP \(bu 2.3
 
711
.\}
 
712
.\" myisamchk: force option.\" force option: myisamchk\fB\-\-force\fR,
 
713
\fB\-f\fR
 
714
.sp
 
715
Do a repair operation automatically if
 
716
\fBmyisamchk\fR
 
717
finds any errors in the table\&. The repair type is the same as that specified with the
 
718
\fB\-\-recover\fR
 
719
or
 
720
\fB\-r\fR
 
721
option\&.
 
722
.RE
 
723
.sp
 
724
.RS 4
 
725
.ie n \{\
 
726
\h'-04'\(bu\h'+03'\c
 
727
.\}
 
728
.el \{\
 
729
.sp -1
 
730
.IP \(bu 2.3
 
731
.\}
 
732
.\" myisamchk: information option.\" information option: myisamchk\fB\-\-information\fR,
 
733
\fB\-i\fR
 
734
.sp
 
735
Print informational statistics about the table that is checked\&.
 
736
.RE
 
737
.sp
 
738
.RS 4
 
739
.ie n \{\
 
740
\h'-04'\(bu\h'+03'\c
 
741
.\}
 
742
.el \{\
 
743
.sp -1
 
744
.IP \(bu 2.3
 
745
.\}
 
746
.\" myisamchk: medium-check option.\" medium-check option: myisamchk\fB\-\-medium\-check\fR,
 
747
\fB\-m\fR
 
748
.sp
 
749
Do a check that is faster than an
 
750
\fB\-\-extend\-check\fR
 
751
operation\&. This finds only 99\&.99% of all errors, which should be good enough in most cases\&.
 
752
.RE
 
753
.sp
 
754
.RS 4
 
755
.ie n \{\
 
756
\h'-04'\(bu\h'+03'\c
 
757
.\}
 
758
.el \{\
 
759
.sp -1
 
760
.IP \(bu 2.3
 
761
.\}
 
762
.\" myisamchk: read-only option.\" read-only option: myisamchk\fB\-\-read\-only\fR,
 
763
\fB\-T\fR
 
764
.sp
 
765
Do not mark the table as checked\&. This is useful if you use
 
766
\fBmyisamchk\fR
 
767
to check a table that is in use by some other application that does not use locking, such as
 
768
\fBmysqld\fR
 
769
when run with external locking disabled\&.
 
770
.RE
 
771
.sp
 
772
.RS 4
 
773
.ie n \{\
 
774
\h'-04'\(bu\h'+03'\c
 
775
.\}
 
776
.el \{\
 
777
.sp -1
 
778
.IP \(bu 2.3
 
779
.\}
 
780
.\" myisamchk: update-state option.\" update-state option: myisamchk\fB\-\-update\-state\fR,
 
781
\fB\-U\fR
 
782
.sp
 
783
Store information in the
 
784
\&.MYI
 
785
file to indicate when the table was checked and whether the table crashed\&. This should be used to get full benefit of the
 
786
\fB\-\-check\-only\-changed\fR
 
787
option, but you shouldn\*(Aqt use this option if the
 
788
\fBmysqld\fR
 
789
server is using the table and you are running it with external locking disabled\&.
 
790
.RE
 
791
.SH "MYISAMCHK REPAIR OPTIONS"
 
792
.\" repair options: myisamchk
 
793
.\" files: repairing
 
794
.PP
 
795
\fBmyisamchk\fR
 
796
supports the following options for table repair operations (operations performed when an option such as
 
797
\fB\-\-recover\fR
 
798
or
 
799
\fB\-\-safe\-recover\fR
 
800
is given):
 
801
.sp
 
802
.RS 4
 
803
.ie n \{\
 
804
\h'-04'\(bu\h'+03'\c
 
805
.\}
 
806
.el \{\
 
807
.sp -1
 
808
.IP \(bu 2.3
 
809
.\}
 
810
.\" myisamchk: backup option.\" backup option: myisamchk\fB\-\-backup\fR,
 
811
\fB\-B\fR
 
812
.sp
 
813
Make a backup of the
 
814
\&.MYD
 
815
file as
 
816
\fIfile_name\fR\-\fItime\fR\&.BAK
 
817
.RE
 
818
.sp
 
819
.RS 4
 
820
.ie n \{\
 
821
\h'-04'\(bu\h'+03'\c
 
822
.\}
 
823
.el \{\
 
824
.sp -1
 
825
.IP \(bu 2.3
 
826
.\}
 
827
.\" myisamchk: character-sets-dir option.\" character-sets-dir option: myisamchk\fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR
 
828
.sp
 
829
The directory where character sets are installed\&. See
 
830
Section\ \&10.5, \(lqCharacter Set Configuration\(rq\&.
 
831
.RE
 
832
.sp
 
833
.RS 4
 
834
.ie n \{\
 
835
\h'-04'\(bu\h'+03'\c
 
836
.\}
 
837
.el \{\
 
838
.sp -1
 
839
.IP \(bu 2.3
 
840
.\}
 
841
.\" myisamchk: correct-checksum option.\" correct-checksum option: myisamchk\fB\-\-correct\-checksum\fR
 
842
.sp
 
843
Correct the checksum information for the table\&.
 
844
.RE
 
845
.sp
 
846
.RS 4
 
847
.ie n \{\
 
848
\h'-04'\(bu\h'+03'\c
 
849
.\}
 
850
.el \{\
 
851
.sp -1
 
852
.IP \(bu 2.3
 
853
.\}
 
854
.\" myisamchk: data-file-length option.\" data-file-length option: myisamchk\fB\-\-data\-file\-length=\fR\fB\fIlen\fR\fR,
 
855
\fB\-D \fR\fB\fIlen\fR\fR
 
856
.sp
 
857
The maximum length of the data file (when re\-creating data file when it is
 
858
\(lqfull\(rq)\&.
 
859
.RE
 
860
.sp
 
861
.RS 4
 
862
.ie n \{\
 
863
\h'-04'\(bu\h'+03'\c
 
864
.\}
 
865
.el \{\
 
866
.sp -1
 
867
.IP \(bu 2.3
 
868
.\}
 
869
.\" myisamchk: extend-check option.\" extend-check option: myisamchk\fB\-\-extend\-check\fR,
 
870
\fB\-e\fR
 
871
.sp
 
872
Do a repair that tries to recover every possible row from the data file\&. Normally, this also finds a lot of garbage rows\&. Do not use this option unless you are desperate\&.
 
873
.sp
 
874
See also the description of this option under table checking options\&.
 
875
.sp
 
876
For a description of the output format, see
 
877
the section called \(lqOBTAINING TABLE INFORMATION WITH MYISAMCHK\(rq\&.
 
878
.RE
 
879
.sp
 
880
.RS 4
 
881
.ie n \{\
 
882
\h'-04'\(bu\h'+03'\c
 
883
.\}
 
884
.el \{\
 
885
.sp -1
 
886
.IP \(bu 2.3
 
887
.\}
 
888
.\" myisamchk: force option.\" force option: myisamchk\fB\-\-force\fR,
 
889
\fB\-f\fR
 
890
.sp
 
891
Overwrite old intermediate files (files with names like
 
892
\fItbl_name\fR\&.TMD) instead of aborting\&.
 
893
.RE
 
894
.sp
 
895
.RS 4
 
896
.ie n \{\
 
897
\h'-04'\(bu\h'+03'\c
 
898
.\}
 
899
.el \{\
 
900
.sp -1
 
901
.IP \(bu 2.3
 
902
.\}
 
903
.\" myisamchk: keys-used option.\" keys-used option: myisamchk\fB\-\-keys\-used=\fR\fB\fIval\fR\fR,
 
904
\fB\-k \fR\fB\fIval\fR\fR
 
905
.sp
 
906
For
 
907
\fBmyisamchk\fR, the option value is a bit\-value that indicates which indexes to update\&. Each binary bit of the option value corresponds to a table index, where the first index is bit 0\&. An option value of 0 disables updates to all indexes, which can be used to get faster inserts\&. Deactivated indexes can be reactivated by using
 
908
\fBmyisamchk \-r\fR\&.
 
909
.RE
 
910
.sp
 
911
.RS 4
 
912
.ie n \{\
 
913
\h'-04'\(bu\h'+03'\c
 
914
.\}
 
915
.el \{\
 
916
.sp -1
 
917
.IP \(bu 2.3
 
918
.\}
 
919
.\" myisamchk: no-symlinks option.\" no-symlinks option: myisamchk\fB\-\-no\-symlinks\fR,
 
920
\fB\-l\fR
 
921
.sp
 
922
Do not follow symbolic links\&. Normally
 
923
\fBmyisamchk\fR
 
924
repairs the table that a symlink points to\&. This option does not exist as of MySQL 4\&.0 because versions from 4\&.0 on do not remove symlinks during repair operations\&.
 
925
.RE
 
926
.sp
 
927
.RS 4
 
928
.ie n \{\
 
929
\h'-04'\(bu\h'+03'\c
 
930
.\}
 
931
.el \{\
 
932
.sp -1
 
933
.IP \(bu 2.3
 
934
.\}
 
935
.\" myisamchk: max-record-length option.\" max-record-length option: myisamchk\fB\-\-max\-record\-length=\fR\fB\fIlen\fR\fR
 
936
.sp
 
937
Skip rows larger than the given length if
 
938
\fBmyisamchk\fR
 
939
cannot allocate memory to hold them\&.
 
940
.RE
 
941
.sp
 
942
.RS 4
 
943
.ie n \{\
 
944
\h'-04'\(bu\h'+03'\c
 
945
.\}
 
946
.el \{\
 
947
.sp -1
 
948
.IP \(bu 2.3
 
949
.\}
 
950
.\" myisamchk: parallel-recover option.\" parallel-recover option: myisamchk\fB\-\-parallel\-recover\fR,
 
951
\fB\-p\fR
 
952
.sp
 
953
Use the same technique as
 
954
\fB\-r\fR
 
955
and
 
956
\fB\-n\fR, but create all the keys in parallel, using different threads\&.
 
957
\fIThis is beta\-quality code\&. Use at your own risk!\fR
 
958
.RE
 
959
.sp
 
960
.RS 4
 
961
.ie n \{\
 
962
\h'-04'\(bu\h'+03'\c
 
963
.\}
 
964
.el \{\
 
965
.sp -1
 
966
.IP \(bu 2.3
 
967
.\}
 
968
.\" myisamchk: quick option.\" quick option: myisamchk\fB\-\-quick\fR,
 
969
\fB\-q\fR
 
970
.sp
 
971
Achieve a faster repair by modifying only the index file, not the data file\&. You can specify this option twice to force
 
972
\fBmyisamchk\fR
 
973
to modify the original data file in case of duplicate keys\&.
 
974
.RE
 
975
.sp
 
976
.RS 4
 
977
.ie n \{\
 
978
\h'-04'\(bu\h'+03'\c
 
979
.\}
 
980
.el \{\
 
981
.sp -1
 
982
.IP \(bu 2.3
 
983
.\}
 
984
.\" myisamchk: recover option.\" recover option: myisamchk\fB\-\-recover\fR,
 
985
\fB\-r\fR
 
986
.sp
 
987
Do a repair that can fix almost any problem except unique keys that are not unique (which is an extremely unlikely error with
 
988
MyISAM
 
989
tables)\&. If you want to recover a table, this is the option to try first\&. You should try
 
990
\fB\-\-safe\-recover\fR
 
991
only if
 
992
\fBmyisamchk\fR
 
993
reports that the table cannot be recovered using
 
994
\fB\-\-recover\fR\&. (In the unlikely case that
 
995
\fB\-\-recover\fR
 
996
fails, the data file remains intact\&.)
 
997
.sp
 
998
If you have lots of memory, you should increase the value of
 
999
myisam_sort_buffer_size\&.
 
1000
.RE
 
1001
.sp
 
1002
.RS 4
 
1003
.ie n \{\
 
1004
\h'-04'\(bu\h'+03'\c
 
1005
.\}
 
1006
.el \{\
 
1007
.sp -1
 
1008
.IP \(bu 2.3
 
1009
.\}
 
1010
.\" myisamchk: safe-recover option.\" safe-recover option: myisamchk\fB\-\-safe\-recover\fR,
 
1011
\fB\-o\fR
 
1012
.sp
 
1013
Do a repair using an old recovery method that reads through all rows in order and updates all index trees based on the rows found\&. This is an order of magnitude slower than
 
1014
\fB\-\-recover\fR, but can handle a couple of very unlikely cases that
 
1015
\fB\-\-recover\fR
 
1016
cannot\&. This recovery method also uses much less disk space than
 
1017
\fB\-\-recover\fR\&. Normally, you should repair first using
 
1018
\fB\-\-recover\fR, and then with
 
1019
\fB\-\-safe\-recover\fR
 
1020
only if
 
1021
\fB\-\-recover\fR
 
1022
fails\&.
 
1023
.sp
 
1024
If you have lots of memory, you should increase the value of
 
1025
key_buffer_size\&.
 
1026
.RE
 
1027
.sp
 
1028
.RS 4
 
1029
.ie n \{\
 
1030
\h'-04'\(bu\h'+03'\c
 
1031
.\}
 
1032
.el \{\
 
1033
.sp -1
 
1034
.IP \(bu 2.3
 
1035
.\}
 
1036
.\" myisamchk: set-character-set option.\" set-character-set option: myisamchk\fB\-\-set\-character\-set=\fR\fB\fIname\fR\fR
 
1037
.sp
 
1038
Change the character set used by the table indexes\&. This option was replaced by
 
1039
\fB\-\-set\-collation\fR
 
1040
in MySQL 5\&.0\&.3\&.
 
1041
.RE
 
1042
.sp
 
1043
.RS 4
 
1044
.ie n \{\
 
1045
\h'-04'\(bu\h'+03'\c
 
1046
.\}
 
1047
.el \{\
 
1048
.sp -1
 
1049
.IP \(bu 2.3
 
1050
.\}
 
1051
.\" myisamchk: set-collation option.\" set-collation option: myisamchk\fB\-\-set\-collation=\fR\fB\fIname\fR\fR
 
1052
.sp
 
1053
Specify the collation to use for sorting table indexes\&. The character set name is implied by the first part of the collation name\&.
 
1054
.RE
 
1055
.sp
 
1056
.RS 4
 
1057
.ie n \{\
 
1058
\h'-04'\(bu\h'+03'\c
 
1059
.\}
 
1060
.el \{\
 
1061
.sp -1
 
1062
.IP \(bu 2.3
 
1063
.\}
 
1064
.\" myisamchk: sort-recover option.\" sort-recover option: myisamchk\fB\-\-sort\-recover\fR,
 
1065
\fB\-n\fR
 
1066
.sp
 
1067
Force
 
1068
\fBmyisamchk\fR
 
1069
to use sorting to resolve the keys even if the temporary files would be very large\&.
 
1070
.RE
 
1071
.sp
 
1072
.RS 4
 
1073
.ie n \{\
 
1074
\h'-04'\(bu\h'+03'\c
 
1075
.\}
 
1076
.el \{\
 
1077
.sp -1
 
1078
.IP \(bu 2.3
 
1079
.\}
 
1080
.\" myisamchk: tmpdir option.\" tmpdir option: myisamchk\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR,
 
1081
\fB\-t \fR\fB\fIpath\fR\fR
 
1082
.sp
 
1083
The path of the directory to be used for storing temporary files\&. If this is not set,
 
1084
\fBmyisamchk\fR
 
1085
uses the value of the
 
1086
TMPDIR
 
1087
environment variable\&.
 
1088
\fB\-\-tmpdir\fR
 
1089
can be set to a list of directory paths that are used successively in round\-robin fashion for creating temporary files\&. The separator character between directory names is the colon (\(lq:\(rq) on Unix and the semicolon (\(lq;\(rq) on Windows\&.
 
1090
.RE
 
1091
.sp
 
1092
.RS 4
 
1093
.ie n \{\
 
1094
\h'-04'\(bu\h'+03'\c
 
1095
.\}
 
1096
.el \{\
 
1097
.sp -1
 
1098
.IP \(bu 2.3
 
1099
.\}
 
1100
.\" myisamchk: unpack option.\" unpack option: myisamchk\fB\-\-unpack\fR,
 
1101
\fB\-u\fR
 
1102
.sp
 
1103
Unpack a table that was packed with
 
1104
\fBmyisampack\fR\&.
 
1105
.RE
 
1106
.SH "OTHER MYISAMCHK OPTIONS"
 
1107
.PP
 
1108
\fBmyisamchk\fR
 
1109
supports the following options for actions other than table checks and repairs:
 
1110
.sp
 
1111
.RS 4
 
1112
.ie n \{\
 
1113
\h'-04'\(bu\h'+03'\c
 
1114
.\}
 
1115
.el \{\
 
1116
.sp -1
 
1117
.IP \(bu 2.3
 
1118
.\}
 
1119
.\" myisamchk: analyze option.\" analyze option: myisamchk\fB\-\-analyze\fR,
 
1120
\fB\-a\fR
 
1121
.sp
 
1122
Analyze the distribution of key values\&. This improves join performance by enabling the join optimizer to better choose the order in which to join the tables and which indexes it should use\&. To obtain information about the key distribution, use a
 
1123
\fBmyisamchk \-\-description \-\-verbose \fR\fB\fItbl_name\fR\fR
 
1124
command or the
 
1125
SHOW INDEX FROM \fItbl_name\fR
 
1126
statement\&.
 
1127
.RE
 
1128
.sp
 
1129
.RS 4
 
1130
.ie n \{\
 
1131
\h'-04'\(bu\h'+03'\c
 
1132
.\}
 
1133
.el \{\
 
1134
.sp -1
 
1135
.IP \(bu 2.3
 
1136
.\}
 
1137
.\" myisamchk: block-search option.\" block-search option: myisamchk\fB\-\-block\-search=\fR\fB\fIoffset\fR\fR,
 
1138
\fB\-b \fR\fB\fIoffset\fR\fR
 
1139
.sp
 
1140
Find the record that a block at the given offset belongs to\&.
 
1141
.RE
 
1142
.sp
 
1143
.RS 4
 
1144
.ie n \{\
 
1145
\h'-04'\(bu\h'+03'\c
 
1146
.\}
 
1147
.el \{\
 
1148
.sp -1
 
1149
.IP \(bu 2.3
 
1150
.\}
 
1151
.\" myisamchk: description option.\" description option: myisamchk\fB\-\-description\fR,
 
1152
\fB\-d\fR
 
1153
.sp
 
1154
Print some descriptive information about the table\&. Specifying the
 
1155
\fB\-\-verbose\fR
 
1156
option once or twice produces additional information\&. See
 
1157
the section called \(lqOBTAINING TABLE INFORMATION WITH MYISAMCHK\(rq\&.
 
1158
.RE
 
1159
.sp
 
1160
.RS 4
 
1161
.ie n \{\
 
1162
\h'-04'\(bu\h'+03'\c
 
1163
.\}
 
1164
.el \{\
 
1165
.sp -1
 
1166
.IP \(bu 2.3
 
1167
.\}
 
1168
.\" myisamchk: set-auto-increment[ option.\" set-auto-increment[ option: myisamchk\fB\-\-set\-auto\-increment[=\fR\fB\fIvalue\fR\fR\fB]\fR,
 
1169
\fB\-A[\fR\fB\fIvalue\fR\fR\fB]\fR
 
1170
.sp
 
1171
Force
 
1172
AUTO_INCREMENT
 
1173
numbering for new records to start at the given value (or higher, if there are existing records with
 
1174
AUTO_INCREMENT
 
1175
values this large)\&. If
 
1176
\fIvalue\fR
 
1177
is not specified,
 
1178
AUTO_INCREMENT
 
1179
numbers for new records begin with the largest value currently in the table, plus one\&.
 
1180
.RE
 
1181
.sp
 
1182
.RS 4
 
1183
.ie n \{\
 
1184
\h'-04'\(bu\h'+03'\c
 
1185
.\}
 
1186
.el \{\
 
1187
.sp -1
 
1188
.IP \(bu 2.3
 
1189
.\}
 
1190
.\" myisamchk: sort-index option.\" sort-index option: myisamchk\fB\-\-sort\-index\fR,
 
1191
\fB\-S\fR
 
1192
.sp
 
1193
Sort the index tree blocks in high\-low order\&. This optimizes seeks and makes table scans that use indexes faster\&.
 
1194
.RE
 
1195
.sp
 
1196
.RS 4
 
1197
.ie n \{\
 
1198
\h'-04'\(bu\h'+03'\c
 
1199
.\}
 
1200
.el \{\
 
1201
.sp -1
 
1202
.IP \(bu 2.3
 
1203
.\}
 
1204
.\" myisamchk: sort-records option.\" sort-records option: myisamchk\fB\-\-sort\-records=\fR\fB\fIN\fR\fR,
 
1205
\fB\-R \fR\fB\fIN\fR\fR
 
1206
.sp
 
1207
Sort records according to a particular index\&. This makes your data much more localized and may speed up range\-based
 
1208
SELECT
 
1209
and
 
1210
ORDER BY
 
1211
operations that use this index\&. (The first time you use this option to sort a table, it may be very slow\&.) To determine a table\*(Aqs index numbers, use
 
1212
SHOW INDEX, which displays a table\*(Aqs indexes in the same order that
 
1213
\fBmyisamchk\fR
 
1214
sees them\&. Indexes are numbered beginning with 1\&.
 
1215
.sp
 
1216
If keys are not packed (PACK_KEYS=0), they have the same length, so when
 
1217
\fBmyisamchk\fR
 
1218
sorts and moves records, it just overwrites record offsets in the index\&. If keys are packed (PACK_KEYS=1),
 
1219
\fBmyisamchk\fR
 
1220
must unpack key blocks first, then re\-create indexes and pack the key blocks again\&. (In this case, re\-creating indexes is faster than updating offsets for each index\&.)
 
1221
.RE
 
1222
.SH "OBTAINING TABLE INFORMATION WITH MYISAMCHK"
 
1223
.\" table description: myisamchk
 
1224
.\" tables: information
 
1225
.\" examples: myisamchk output
 
1226
.\" myisamchk: example output
 
1227
.PP
 
1228
To obtain a description of a
 
1229
MyISAM
 
1230
table or statistics about it, use the commands shown here\&. The output from these commands is explained later in this section\&.
 
1231
.sp
 
1232
.RS 4
 
1233
.ie n \{\
 
1234
\h'-04'\(bu\h'+03'\c
 
1235
.\}
 
1236
.el \{\
 
1237
.sp -1
 
1238
.IP \(bu 2.3
 
1239
.\}
 
1240
\fBmyisamchk \-d \fR\fB\fItbl_name\fR\fR
 
1241
.sp
 
1242
Runs
 
1243
\fBmyisamchk\fR
 
1244
in
 
1245
\(lqdescribe mode\(rq
 
1246
to produce a description of your table\&. If you start the MySQL server with external locking disabled,
 
1247
\fBmyisamchk\fR
 
1248
may report an error for a table that is updated while it runs\&. However, because
 
1249
\fBmyisamchk\fR
 
1250
does not change the table in describe mode, there is no risk of destroying data\&.
 
1251
.RE
 
1252
.sp
 
1253
.RS 4
 
1254
.ie n \{\
 
1255
\h'-04'\(bu\h'+03'\c
 
1256
.\}
 
1257
.el \{\
 
1258
.sp -1
 
1259
.IP \(bu 2.3
 
1260
.\}
 
1261
\fBmyisamchk \-dv \fR\fB\fItbl_name\fR\fR
 
1262
.sp
 
1263
Adding
 
1264
\fB\-v\fR
 
1265
runs
 
1266
\fBmyisamchk\fR
 
1267
in verbose mode so that it produces more information about the table\&. Adding
 
1268
\fB\-v\fR
 
1269
a second time produces even more information\&.
 
1270
.RE
 
1271
.sp
 
1272
.RS 4
 
1273
.ie n \{\
 
1274
\h'-04'\(bu\h'+03'\c
 
1275
.\}
 
1276
.el \{\
 
1277
.sp -1
 
1278
.IP \(bu 2.3
 
1279
.\}
 
1280
\fBmyisamchk \-eis \fR\fB\fItbl_name\fR\fR
 
1281
.sp
 
1282
Shows only the most important information from a table\&. This operation is slow because it must read the entire table\&.
 
1283
.RE
 
1284
.sp
 
1285
.RS 4
 
1286
.ie n \{\
 
1287
\h'-04'\(bu\h'+03'\c
 
1288
.\}
 
1289
.el \{\
 
1290
.sp -1
 
1291
.IP \(bu 2.3
 
1292
.\}
 
1293
\fBmyisamchk \-eiv \fR\fB\fItbl_name\fR\fR
 
1294
.sp
 
1295
This is like
 
1296
\fB\-eis\fR, but tells you what is being done\&.
 
1297
.RE
 
1298
.PP
 
1299
The
 
1300
\fItbl_name\fR
 
1301
argument can be either the name of a
 
1302
MyISAM
 
1303
table or the name of its index file, as described in
 
1304
\fBmyisamchk\fR(1)\&. Multiple
 
1305
\fItbl_name\fR
 
1306
arguments can be given\&.
 
1307
.PP
 
1308
Suppose that a table named
 
1309
person
 
1310
has the following structure\&. (The
 
1311
MAX_ROWS
 
1312
table option is included so that in the example output from
 
1313
\fBmyisamchk\fR
 
1314
shown later, some values are smaller and fit the output format more easily\&.)
 
1315
.sp
 
1316
.if n \{\
 
1317
.RS 4
 
1318
.\}
 
1319
.nf
 
1320
CREATE TABLE person
 
1321
(
 
1322
  id         INT NOT NULL AUTO_INCREMENT,
 
1323
  last_name  VARCHAR(20) NOT NULL,
 
1324
  first_name VARCHAR(20) NOT NULL,
 
1325
  birth      DATE,
 
1326
  death      DATE,
 
1327
  PRIMARY KEY (id),
 
1328
  INDEX (last_name, first_name),
 
1329
  INDEX (birth)
 
1330
) MAX_ROWS = 1000000;
 
1331
.fi
 
1332
.if n \{\
 
1333
.RE
 
1334
.\}
 
1335
.PP
 
1336
Suppose also that the table has these data and index file sizes:
 
1337
.sp
 
1338
.if n \{\
 
1339
.RS 4
 
1340
.\}
 
1341
.nf
 
1342
\-rw\-rw\-\-\-\-  1 mysql  mysql  9347072 Aug 19 11:47 person\&.MYD
 
1343
\-rw\-rw\-\-\-\-  1 mysql  mysql  6066176 Aug 19 11:47 person\&.MYI
 
1344
.fi
 
1345
.if n \{\
 
1346
.RE
 
1347
.\}
 
1348
.PP
 
1349
Example of
 
1350
\fBmyisamchk \-dvv\fR
 
1351
output:
 
1352
.sp
 
1353
.if n \{\
 
1354
.RS 4
 
1355
.\}
 
1356
.nf
 
1357
MyISAM file:         person
 
1358
Record format:       Packed
 
1359
Character set:       latin1_swedish_ci (8)
 
1360
File\-version:        1
 
1361
Creation time:       2009\-08\-19 16:47:41
 
1362
Recover time:        2009\-08\-19 16:47:56
 
1363
Status:              checked,analyzed,optimized keys
 
1364
Auto increment key:              1  Last value:                306688
 
1365
Data records:               306688  Deleted blocks:                 0
 
1366
Datafile parts:             306688  Deleted data:                   0
 
1367
Datafile pointer (bytes):        4  Keyfile pointer (bytes):        3
 
1368
Datafile length:           9347072  Keyfile length:           6066176
 
1369
Max datafile length:    4294967294  Max keyfile length:   17179868159
 
1370
Recordlength:                   54
 
1371
table description:
 
1372
Key Start Len Index   Type                 Rec/key         Root  Blocksize
 
1373
1   2     4   unique  long                       1        99328       1024
 
1374
2   6     20  multip\&. varchar prefix           512      3563520       1024
 
1375
    27    20          varchar                  512
 
1376
3   48    3   multip\&. uint24 NULL           306688      6065152       1024
 
1377
Field Start Length Nullpos Nullbit Type
 
1378
1     1     1
 
1379
2     2     4                      no zeros
 
1380
3     6     21                     varchar
 
1381
4     27    21                     varchar
 
1382
5     48    3      1       1       no zeros
 
1383
6     51    3      1       2       no zeros
 
1384
.fi
 
1385
.if n \{\
 
1386
.RE
 
1387
.\}
 
1388
.PP
 
1389
Explanations for the types of information
 
1390
\fBmyisamchk\fR
 
1391
produces are given here\&.
 
1392
\(lqKeyfile\(rq
 
1393
refers to the index file\&.
 
1394
\(lqRecord\(rq
 
1395
and
 
1396
\(lqrow\(rq
 
1397
are synonymous, as are
 
1398
\(lqfield\(rq
 
1399
and
 
1400
\(lqcolumn\&.\(rq
 
1401
.PP
 
1402
The initial part of the table description contains these values:
 
1403
.sp
 
1404
.RS 4
 
1405
.ie n \{\
 
1406
\h'-04'\(bu\h'+03'\c
 
1407
.\}
 
1408
.el \{\
 
1409
.sp -1
 
1410
.IP \(bu 2.3
 
1411
.\}
 
1412
MyISAM file
 
1413
.sp
 
1414
Name of the
 
1415
MyISAM
 
1416
(index) file\&.
 
1417
.RE
 
1418
.sp
 
1419
.RS 4
 
1420
.ie n \{\
 
1421
\h'-04'\(bu\h'+03'\c
 
1422
.\}
 
1423
.el \{\
 
1424
.sp -1
 
1425
.IP \(bu 2.3
 
1426
.\}
 
1427
Record format
 
1428
.sp
 
1429
The format used to store table rows\&. The preceding examples use
 
1430
Fixed length\&. Other possible values are
 
1431
Compressed
 
1432
and
 
1433
Packed\&. (Packed
 
1434
corresponds to what
 
1435
SHOW TABLE STATUS
 
1436
reports as
 
1437
Dynamic\&.)
 
1438
.RE
 
1439
.sp
 
1440
.RS 4
 
1441
.ie n \{\
 
1442
\h'-04'\(bu\h'+03'\c
 
1443
.\}
 
1444
.el \{\
 
1445
.sp -1
 
1446
.IP \(bu 2.3
 
1447
.\}
 
1448
Chararacter set
 
1449
.sp
 
1450
The table default character set\&.
 
1451
.RE
 
1452
.sp
 
1453
.RS 4
 
1454
.ie n \{\
 
1455
\h'-04'\(bu\h'+03'\c
 
1456
.\}
 
1457
.el \{\
 
1458
.sp -1
 
1459
.IP \(bu 2.3
 
1460
.\}
 
1461
File\-version
 
1462
.sp
 
1463
Version of
 
1464
MyISAM
 
1465
format\&. Currently always 1\&.
 
1466
.RE
 
1467
.sp
 
1468
.RS 4
 
1469
.ie n \{\
 
1470
\h'-04'\(bu\h'+03'\c
 
1471
.\}
 
1472
.el \{\
 
1473
.sp -1
 
1474
.IP \(bu 2.3
 
1475
.\}
 
1476
Creation time
 
1477
.sp
 
1478
When the data file was created\&.
 
1479
.RE
 
1480
.sp
 
1481
.RS 4
 
1482
.ie n \{\
 
1483
\h'-04'\(bu\h'+03'\c
 
1484
.\}
 
1485
.el \{\
 
1486
.sp -1
 
1487
.IP \(bu 2.3
 
1488
.\}
 
1489
Recover time
 
1490
.sp
 
1491
When the index/data file was last reconstructed\&.
 
1492
.RE
 
1493
.sp
 
1494
.RS 4
 
1495
.ie n \{\
 
1496
\h'-04'\(bu\h'+03'\c
 
1497
.\}
 
1498
.el \{\
 
1499
.sp -1
 
1500
.IP \(bu 2.3
 
1501
.\}
 
1502
Status
 
1503
.sp
 
1504
Table status flags\&. Possible values are
 
1505
crashed,
 
1506
open,
 
1507
changed,
 
1508
analyzed,
 
1509
optimized keys, and
 
1510
sorted index pages\&.
 
1511
.RE
 
1512
.sp
 
1513
.RS 4
 
1514
.ie n \{\
 
1515
\h'-04'\(bu\h'+03'\c
 
1516
.\}
 
1517
.el \{\
 
1518
.sp -1
 
1519
.IP \(bu 2.3
 
1520
.\}
 
1521
Auto increment key,
 
1522
Last value
 
1523
.sp
 
1524
The key number associated the table\*(Aqs
 
1525
AUTO_INCREMENT
 
1526
column, and the most recently generated value for this column\&. These fields do not appear if there is no such column\&.
 
1527
.RE
 
1528
.sp
 
1529
.RS 4
 
1530
.ie n \{\
 
1531
\h'-04'\(bu\h'+03'\c
 
1532
.\}
 
1533
.el \{\
 
1534
.sp -1
 
1535
.IP \(bu 2.3
 
1536
.\}
 
1537
Data records
 
1538
.sp
 
1539
The number of rows in the table\&.
 
1540
.RE
 
1541
.sp
 
1542
.RS 4
 
1543
.ie n \{\
 
1544
\h'-04'\(bu\h'+03'\c
 
1545
.\}
 
1546
.el \{\
 
1547
.sp -1
 
1548
.IP \(bu 2.3
 
1549
.\}
 
1550
Deleted blocks
 
1551
.sp
 
1552
How many deleted blocks still have reserved space\&. You can optimize your table to minimize this space\&. See
 
1553
Section\ \&7.6.4, \(lqMyISAM Table Optimization\(rq\&.
 
1554
.RE
 
1555
.sp
 
1556
.RS 4
 
1557
.ie n \{\
 
1558
\h'-04'\(bu\h'+03'\c
 
1559
.\}
 
1560
.el \{\
 
1561
.sp -1
 
1562
.IP \(bu 2.3
 
1563
.\}
 
1564
Datafile parts
 
1565
.sp
 
1566
For dynamic\-row format, this indicates how many data blocks there are\&. For an optimized table without fragmented rows, this is the same as
 
1567
Data records\&.
 
1568
.RE
 
1569
.sp
 
1570
.RS 4
 
1571
.ie n \{\
 
1572
\h'-04'\(bu\h'+03'\c
 
1573
.\}
 
1574
.el \{\
 
1575
.sp -1
 
1576
.IP \(bu 2.3
 
1577
.\}
 
1578
Deleted data
 
1579
.sp
 
1580
How many bytes of unreclaimed deleted data there are\&. You can optimize your table to minimize this space\&. See
 
1581
Section\ \&7.6.4, \(lqMyISAM Table Optimization\(rq\&.
 
1582
.RE
 
1583
.sp
 
1584
.RS 4
 
1585
.ie n \{\
 
1586
\h'-04'\(bu\h'+03'\c
 
1587
.\}
 
1588
.el \{\
 
1589
.sp -1
 
1590
.IP \(bu 2.3
 
1591
.\}
 
1592
Datafile pointer
 
1593
.sp
 
1594
The size of the data file pointer, in bytes\&. It is usually 2, 3, 4, or 5 bytes\&. Most tables manage with 2 bytes, but this cannot be controlled from MySQL yet\&. For fixed tables, this is a row address\&. For dynamic tables, this is a byte address\&.
 
1595
.RE
 
1596
.sp
 
1597
.RS 4
 
1598
.ie n \{\
 
1599
\h'-04'\(bu\h'+03'\c
 
1600
.\}
 
1601
.el \{\
 
1602
.sp -1
 
1603
.IP \(bu 2.3
 
1604
.\}
 
1605
Keyfile pointer
 
1606
.sp
 
1607
The size of the index file pointer, in bytes\&. It is usually 1, 2, or 3 bytes\&. Most tables manage with 2 bytes, but this is calculated automatically by MySQL\&. It is always a block address\&.
 
1608
.RE
 
1609
.sp
 
1610
.RS 4
 
1611
.ie n \{\
 
1612
\h'-04'\(bu\h'+03'\c
 
1613
.\}
 
1614
.el \{\
 
1615
.sp -1
 
1616
.IP \(bu 2.3
 
1617
.\}
 
1618
Max datafile length
 
1619
.sp
 
1620
How long the table data file can become, in bytes\&.
 
1621
.RE
 
1622
.sp
 
1623
.RS 4
 
1624
.ie n \{\
 
1625
\h'-04'\(bu\h'+03'\c
 
1626
.\}
 
1627
.el \{\
 
1628
.sp -1
 
1629
.IP \(bu 2.3
 
1630
.\}
 
1631
Max keyfile length
 
1632
.sp
 
1633
How long the table index file can become, in bytes\&.
 
1634
.RE
 
1635
.sp
 
1636
.RS 4
 
1637
.ie n \{\
 
1638
\h'-04'\(bu\h'+03'\c
 
1639
.\}
 
1640
.el \{\
 
1641
.sp -1
 
1642
.IP \(bu 2.3
 
1643
.\}
 
1644
Recordlength
 
1645
.sp
 
1646
How much space each row takes, in bytes\&.
 
1647
.RE
 
1648
.PP
 
1649
The
 
1650
table description
 
1651
part of the output includes a list of all keys in the table\&. For each key,
 
1652
\fBmyisamchk\fR
 
1653
displays some low\-level information:
 
1654
.sp
 
1655
.RS 4
 
1656
.ie n \{\
 
1657
\h'-04'\(bu\h'+03'\c
 
1658
.\}
 
1659
.el \{\
 
1660
.sp -1
 
1661
.IP \(bu 2.3
 
1662
.\}
 
1663
Key
 
1664
.sp
 
1665
This key\*(Aqs number\&. This value is shown only for the first column of the key\&. If this value is missing, the line corresponds to the second or later column of a multiple\-column key\&. For the table shown in the example, there are two
 
1666
table description
 
1667
lines for the second index\&. This indicates that it is a multiple\-part index with two parts\&.
 
1668
.RE
 
1669
.sp
 
1670
.RS 4
 
1671
.ie n \{\
 
1672
\h'-04'\(bu\h'+03'\c
 
1673
.\}
 
1674
.el \{\
 
1675
.sp -1
 
1676
.IP \(bu 2.3
 
1677
.\}
 
1678
Start
 
1679
.sp
 
1680
Where in the row this portion of the index starts\&.
 
1681
.RE
 
1682
.sp
 
1683
.RS 4
 
1684
.ie n \{\
 
1685
\h'-04'\(bu\h'+03'\c
 
1686
.\}
 
1687
.el \{\
 
1688
.sp -1
 
1689
.IP \(bu 2.3
 
1690
.\}
 
1691
Len
 
1692
.sp
 
1693
How long this portion of the index is\&. For packed numbers, this should always be the full length of the column\&. For strings, it may be shorter than the full length of the indexed column, because you can index a prefix of a string column\&. The total length of a multiple\-part key is the sum of the
 
1694
Len
 
1695
values for all key parts\&.
 
1696
.RE
 
1697
.sp
 
1698
.RS 4
 
1699
.ie n \{\
 
1700
\h'-04'\(bu\h'+03'\c
 
1701
.\}
 
1702
.el \{\
 
1703
.sp -1
 
1704
.IP \(bu 2.3
 
1705
.\}
 
1706
Index
 
1707
.sp
 
1708
Whether a key value can exist multiple times in the index\&. Possible values are
 
1709
unique
 
1710
or
 
1711
multip\&.
 
1712
(multiple)\&.
 
1713
.RE
 
1714
.sp
 
1715
.RS 4
 
1716
.ie n \{\
 
1717
\h'-04'\(bu\h'+03'\c
 
1718
.\}
 
1719
.el \{\
 
1720
.sp -1
 
1721
.IP \(bu 2.3
 
1722
.\}
 
1723
Type
 
1724
.sp
 
1725
What data type this portion of the index has\&. This is a
 
1726
MyISAM
 
1727
data type with the possible values
 
1728
packed,
 
1729
stripped, or
 
1730
empty\&.
 
1731
.RE
 
1732
.sp
 
1733
.RS 4
 
1734
.ie n \{\
 
1735
\h'-04'\(bu\h'+03'\c
 
1736
.\}
 
1737
.el \{\
 
1738
.sp -1
 
1739
.IP \(bu 2.3
 
1740
.\}
 
1741
Root
 
1742
.sp
 
1743
Address of the root index block\&.
 
1744
.RE
 
1745
.sp
 
1746
.RS 4
 
1747
.ie n \{\
 
1748
\h'-04'\(bu\h'+03'\c
 
1749
.\}
 
1750
.el \{\
 
1751
.sp -1
 
1752
.IP \(bu 2.3
 
1753
.\}
 
1754
Blocksize
 
1755
.sp
 
1756
The size of each index block\&. By default this is 1024, but the value may be changed at compile time when MySQL is built from source\&.
 
1757
.RE
 
1758
.sp
 
1759
.RS 4
 
1760
.ie n \{\
 
1761
\h'-04'\(bu\h'+03'\c
 
1762
.\}
 
1763
.el \{\
 
1764
.sp -1
 
1765
.IP \(bu 2.3
 
1766
.\}
 
1767
Rec/key
 
1768
.sp
 
1769
This is a statistical value used by the optimizer\&. It tells how many rows there are per value for this index\&. A unique index always has a value of 1\&. This may be updated after a table is loaded (or greatly changed) with
 
1770
\fBmyisamchk \-a\fR\&. If this is not updated at all, a default value of 30 is given\&.
 
1771
.RE
 
1772
.PP
 
1773
The last part of the output provides information about each column:
 
1774
.sp
 
1775
.RS 4
 
1776
.ie n \{\
 
1777
\h'-04'\(bu\h'+03'\c
 
1778
.\}
 
1779
.el \{\
 
1780
.sp -1
 
1781
.IP \(bu 2.3
 
1782
.\}
 
1783
Field
 
1784
.sp
 
1785
The column number\&.
 
1786
.RE
 
1787
.sp
 
1788
.RS 4
 
1789
.ie n \{\
 
1790
\h'-04'\(bu\h'+03'\c
 
1791
.\}
 
1792
.el \{\
 
1793
.sp -1
 
1794
.IP \(bu 2.3
 
1795
.\}
 
1796
Start
 
1797
.sp
 
1798
The byte position of the column within table rows\&.
 
1799
.RE
 
1800
.sp
 
1801
.RS 4
 
1802
.ie n \{\
 
1803
\h'-04'\(bu\h'+03'\c
 
1804
.\}
 
1805
.el \{\
 
1806
.sp -1
 
1807
.IP \(bu 2.3
 
1808
.\}
 
1809
Length
 
1810
.sp
 
1811
The length of the column in bytes\&.
 
1812
.RE
 
1813
.sp
 
1814
.RS 4
 
1815
.ie n \{\
 
1816
\h'-04'\(bu\h'+03'\c
 
1817
.\}
 
1818
.el \{\
 
1819
.sp -1
 
1820
.IP \(bu 2.3
 
1821
.\}
 
1822
Nullpos,
 
1823
Nullbit
 
1824
.sp
 
1825
For columns that can be
 
1826
NULL,
 
1827
MyISAM
 
1828
stores
 
1829
NULL
 
1830
values as a flag in a byte\&. Depending on how many nullable columns there are, there can be one or more bytes used for this purpose\&. The
 
1831
Nullpos
 
1832
and
 
1833
Nullbit
 
1834
values, if nonempty, indicate which byte and bit contains that flag indicating whether the column is
 
1835
NULL\&.
 
1836
.sp
 
1837
The position and number of bytes used to store
 
1838
NULL
 
1839
flags is shown in the line for field 1\&. This is why there are six
 
1840
Field
 
1841
lines for the
 
1842
person
 
1843
table even though it has only five columns\&.
 
1844
.RE
 
1845
.sp
 
1846
.RS 4
 
1847
.ie n \{\
 
1848
\h'-04'\(bu\h'+03'\c
 
1849
.\}
 
1850
.el \{\
 
1851
.sp -1
 
1852
.IP \(bu 2.3
 
1853
.\}
 
1854
Type
 
1855
.sp
 
1856
The data type\&. The value may contain any of the following descriptors:
 
1857
.sp
 
1858
.RS 4
 
1859
.ie n \{\
 
1860
\h'-04'\(bu\h'+03'\c
 
1861
.\}
 
1862
.el \{\
 
1863
.sp -1
 
1864
.IP \(bu 2.3
 
1865
.\}
 
1866
constant
 
1867
.sp
 
1868
All rows have the same value\&.
 
1869
.RE
 
1870
.sp
 
1871
.RS 4
 
1872
.ie n \{\
 
1873
\h'-04'\(bu\h'+03'\c
 
1874
.\}
 
1875
.el \{\
 
1876
.sp -1
 
1877
.IP \(bu 2.3
 
1878
.\}
 
1879
no endspace
 
1880
.sp
 
1881
Do not store endspace\&.
 
1882
.RE
 
1883
.sp
 
1884
.RS 4
 
1885
.ie n \{\
 
1886
\h'-04'\(bu\h'+03'\c
 
1887
.\}
 
1888
.el \{\
 
1889
.sp -1
 
1890
.IP \(bu 2.3
 
1891
.\}
 
1892
no endspace, not_always
 
1893
.sp
 
1894
Do not store endspace and do not do endspace compression for all values\&.
 
1895
.RE
 
1896
.sp
 
1897
.RS 4
 
1898
.ie n \{\
 
1899
\h'-04'\(bu\h'+03'\c
 
1900
.\}
 
1901
.el \{\
 
1902
.sp -1
 
1903
.IP \(bu 2.3
 
1904
.\}
 
1905
no endspace, no empty
 
1906
.sp
 
1907
Do not store endspace\&. Do not store empty values\&.
 
1908
.RE
 
1909
.sp
 
1910
.RS 4
 
1911
.ie n \{\
 
1912
\h'-04'\(bu\h'+03'\c
 
1913
.\}
 
1914
.el \{\
 
1915
.sp -1
 
1916
.IP \(bu 2.3
 
1917
.\}
 
1918
table\-lookup
 
1919
.sp
 
1920
The column was converted to an
 
1921
ENUM\&.
 
1922
.RE
 
1923
.sp
 
1924
.RS 4
 
1925
.ie n \{\
 
1926
\h'-04'\(bu\h'+03'\c
 
1927
.\}
 
1928
.el \{\
 
1929
.sp -1
 
1930
.IP \(bu 2.3
 
1931
.\}
 
1932
zerofill(\fIN\fR)
 
1933
.sp
 
1934
The most significant
 
1935
\fIN\fR
 
1936
bytes in the value are always 0 and are not stored\&.
 
1937
.RE
 
1938
.sp
 
1939
.RS 4
 
1940
.ie n \{\
 
1941
\h'-04'\(bu\h'+03'\c
 
1942
.\}
 
1943
.el \{\
 
1944
.sp -1
 
1945
.IP \(bu 2.3
 
1946
.\}
 
1947
no zeros
 
1948
.sp
 
1949
Do not store zeros\&.
 
1950
.RE
 
1951
.sp
 
1952
.RS 4
 
1953
.ie n \{\
 
1954
\h'-04'\(bu\h'+03'\c
 
1955
.\}
 
1956
.el \{\
 
1957
.sp -1
 
1958
.IP \(bu 2.3
 
1959
.\}
 
1960
always zero
 
1961
.sp
 
1962
Zero values are stored using one bit\&.
 
1963
.RE
 
1964
.RE
 
1965
.sp
 
1966
.RS 4
 
1967
.ie n \{\
 
1968
\h'-04'\(bu\h'+03'\c
 
1969
.\}
 
1970
.el \{\
 
1971
.sp -1
 
1972
.IP \(bu 2.3
 
1973
.\}
 
1974
Huff tree
 
1975
.sp
 
1976
The number of the Huffman tree associated with the column\&.
 
1977
.RE
 
1978
.sp
 
1979
.RS 4
 
1980
.ie n \{\
 
1981
\h'-04'\(bu\h'+03'\c
 
1982
.\}
 
1983
.el \{\
 
1984
.sp -1
 
1985
.IP \(bu 2.3
 
1986
.\}
 
1987
Bits
 
1988
.sp
 
1989
The number of bits used in the Huffman tree\&.
 
1990
.RE
 
1991
.PP
 
1992
The
 
1993
Huff tree
 
1994
and
 
1995
Bits
 
1996
fields are displayed if the table has been compressed with
 
1997
\fBmyisampack\fR\&. See
 
1998
\fBmyisampack\fR(1), for an example of this information\&.
 
1999
.PP
 
2000
Example of
 
2001
\fBmyisamchk \-eiv\fR
 
2002
output:
 
2003
.sp
 
2004
.if n \{\
 
2005
.RS 4
 
2006
.\}
 
2007
.nf
 
2008
Checking MyISAM file: person
 
2009
Data records:  306688   Deleted blocks:       0
 
2010
\- check file\-size
 
2011
\- check record delete\-chain
 
2012
No recordlinks
 
2013
\- check key delete\-chain
 
2014
block_size 1024:
 
2015
\- check index reference
 
2016
\- check data record references index: 1
 
2017
Key:  1:  Keyblocks used:  98%  Packed:    0%  Max levels:  3
 
2018
\- check data record references index: 2
 
2019
Key:  2:  Keyblocks used:  99%  Packed:   97%  Max levels:  3
 
2020
\- check data record references index: 3
 
2021
Key:  3:  Keyblocks used:  98%  Packed:  \-14%  Max levels:  3
 
2022
Total:    Keyblocks used:  98%  Packed:   89%
 
2023
\- check records and index references
 
2024
\fI*** LOTS OF ROW NUMBERS DELETED ***\fR
 
2025
Records:            306688  M\&.recordlength:       25  Packed:            83%
 
2026
Recordspace used:       97% Empty space:           2% Blocks/Record:   1\&.00
 
2027
Record blocks:      306688  Delete blocks:         0
 
2028
Record data:       7934464  Deleted data:          0
 
2029
Lost space:         256512  Linkdata:        1156096
 
2030
User time 43\&.08, System time 1\&.68
 
2031
Maximum resident set size 0, Integral resident set size 0
 
2032
Non\-physical pagefaults 0, Physical pagefaults 0, Swaps 0
 
2033
Blocks in 0 out 7, Messages in 0 out 0, Signals 0
 
2034
Voluntary context switches 0, Involuntary context switches 0
 
2035
Maximum memory usage: 1046926 bytes (1023k)
 
2036
.fi
 
2037
.if n \{\
 
2038
.RE
 
2039
.\}
 
2040
.PP
 
2041
\fBmyisamchk \-eiv\fR
 
2042
output includes the following information:
 
2043
.sp
 
2044
.RS 4
 
2045
.ie n \{\
 
2046
\h'-04'\(bu\h'+03'\c
 
2047
.\}
 
2048
.el \{\
 
2049
.sp -1
 
2050
.IP \(bu 2.3
 
2051
.\}
 
2052
Data records
 
2053
.sp
 
2054
The number of rows in the table\&.
 
2055
.RE
 
2056
.sp
 
2057
.RS 4
 
2058
.ie n \{\
 
2059
\h'-04'\(bu\h'+03'\c
 
2060
.\}
 
2061
.el \{\
 
2062
.sp -1
 
2063
.IP \(bu 2.3
 
2064
.\}
 
2065
Deleted blocks
 
2066
.sp
 
2067
How many deleted blocks still have reserved space\&. You can optimize your table to minimize this space\&. See
 
2068
Section\ \&7.6.4, \(lqMyISAM Table Optimization\(rq\&.
 
2069
.RE
 
2070
.sp
 
2071
.RS 4
 
2072
.ie n \{\
 
2073
\h'-04'\(bu\h'+03'\c
 
2074
.\}
 
2075
.el \{\
 
2076
.sp -1
 
2077
.IP \(bu 2.3
 
2078
.\}
 
2079
Key
 
2080
.sp
 
2081
The key number\&.
 
2082
.RE
 
2083
.sp
 
2084
.RS 4
 
2085
.ie n \{\
 
2086
\h'-04'\(bu\h'+03'\c
 
2087
.\}
 
2088
.el \{\
 
2089
.sp -1
 
2090
.IP \(bu 2.3
 
2091
.\}
 
2092
Keyblocks used
 
2093
.sp
 
2094
What percentage of the keyblocks are used\&. When a table has just been reorganized with
 
2095
\fBmyisamchk\fR, the values are very high (very near theoretical maximum)\&.
 
2096
.RE
 
2097
.sp
 
2098
.RS 4
 
2099
.ie n \{\
 
2100
\h'-04'\(bu\h'+03'\c
 
2101
.\}
 
2102
.el \{\
 
2103
.sp -1
 
2104
.IP \(bu 2.3
 
2105
.\}
 
2106
Packed
 
2107
.sp
 
2108
MySQL tries to pack key values that have a common suffix\&. This can only be used for indexes on
 
2109
CHAR
 
2110
and
 
2111
VARCHAR
 
2112
columns\&. For long indexed strings that have similar leftmost parts, this can significantly reduce the space used\&. In the preceding example, the second key is 40 bytes long and a 97% reduction in space is achieved\&.
 
2113
.RE
 
2114
.sp
 
2115
.RS 4
 
2116
.ie n \{\
 
2117
\h'-04'\(bu\h'+03'\c
 
2118
.\}
 
2119
.el \{\
 
2120
.sp -1
 
2121
.IP \(bu 2.3
 
2122
.\}
 
2123
Max levels
 
2124
.sp
 
2125
How deep the B\-tree for this key is\&. Large tables with long key values get high values\&.
 
2126
.RE
 
2127
.sp
 
2128
.RS 4
 
2129
.ie n \{\
 
2130
\h'-04'\(bu\h'+03'\c
 
2131
.\}
 
2132
.el \{\
 
2133
.sp -1
 
2134
.IP \(bu 2.3
 
2135
.\}
 
2136
Records
 
2137
.sp
 
2138
How many rows are in the table\&.
 
2139
.RE
 
2140
.sp
 
2141
.RS 4
 
2142
.ie n \{\
 
2143
\h'-04'\(bu\h'+03'\c
 
2144
.\}
 
2145
.el \{\
 
2146
.sp -1
 
2147
.IP \(bu 2.3
 
2148
.\}
 
2149
M\&.recordlength
 
2150
.sp
 
2151
The average row length\&. This is the exact row length for tables with fixed\-length rows, because all rows have the same length\&.
 
2152
.RE
 
2153
.sp
 
2154
.RS 4
 
2155
.ie n \{\
 
2156
\h'-04'\(bu\h'+03'\c
 
2157
.\}
 
2158
.el \{\
 
2159
.sp -1
 
2160
.IP \(bu 2.3
 
2161
.\}
 
2162
Packed
 
2163
.sp
 
2164
MySQL strips spaces from the end of strings\&. The
 
2165
Packed
 
2166
value indicates the percentage of savings achieved by doing this\&.
 
2167
.RE
 
2168
.sp
 
2169
.RS 4
 
2170
.ie n \{\
 
2171
\h'-04'\(bu\h'+03'\c
 
2172
.\}
 
2173
.el \{\
 
2174
.sp -1
 
2175
.IP \(bu 2.3
 
2176
.\}
 
2177
Recordspace used
 
2178
.sp
 
2179
What percentage of the data file is used\&.
 
2180
.RE
 
2181
.sp
 
2182
.RS 4
 
2183
.ie n \{\
 
2184
\h'-04'\(bu\h'+03'\c
 
2185
.\}
 
2186
.el \{\
 
2187
.sp -1
 
2188
.IP \(bu 2.3
 
2189
.\}
 
2190
Empty space
 
2191
.sp
 
2192
What percentage of the data file is unused\&.
 
2193
.RE
 
2194
.sp
 
2195
.RS 4
 
2196
.ie n \{\
 
2197
\h'-04'\(bu\h'+03'\c
 
2198
.\}
 
2199
.el \{\
 
2200
.sp -1
 
2201
.IP \(bu 2.3
 
2202
.\}
 
2203
Blocks/Record
 
2204
.sp
 
2205
Average number of blocks per row (that is, how many links a fragmented row is composed of)\&. This is always 1\&.0 for fixed\-format tables\&. This value should stay as close to 1\&.0 as possible\&. If it gets too large, you can reorganize the table\&. See
 
2206
Section\ \&7.6.4, \(lqMyISAM Table Optimization\(rq\&.
 
2207
.RE
 
2208
.sp
 
2209
.RS 4
 
2210
.ie n \{\
 
2211
\h'-04'\(bu\h'+03'\c
 
2212
.\}
 
2213
.el \{\
 
2214
.sp -1
 
2215
.IP \(bu 2.3
 
2216
.\}
 
2217
Recordblocks
 
2218
.sp
 
2219
How many blocks (links) are used\&. For fixed\-format tables, this is the same as the number of rows\&.
 
2220
.RE
 
2221
.sp
 
2222
.RS 4
 
2223
.ie n \{\
 
2224
\h'-04'\(bu\h'+03'\c
 
2225
.\}
 
2226
.el \{\
 
2227
.sp -1
 
2228
.IP \(bu 2.3
 
2229
.\}
 
2230
Deleteblocks
 
2231
.sp
 
2232
How many blocks (links) are deleted\&.
 
2233
.RE
 
2234
.sp
 
2235
.RS 4
 
2236
.ie n \{\
 
2237
\h'-04'\(bu\h'+03'\c
 
2238
.\}
 
2239
.el \{\
 
2240
.sp -1
 
2241
.IP \(bu 2.3
 
2242
.\}
 
2243
Recorddata
 
2244
.sp
 
2245
How many bytes in the data file are used\&.
 
2246
.RE
 
2247
.sp
 
2248
.RS 4
 
2249
.ie n \{\
 
2250
\h'-04'\(bu\h'+03'\c
 
2251
.\}
 
2252
.el \{\
 
2253
.sp -1
 
2254
.IP \(bu 2.3
 
2255
.\}
 
2256
Deleted data
 
2257
.sp
 
2258
How many bytes in the data file are deleted (unused)\&.
 
2259
.RE
 
2260
.sp
 
2261
.RS 4
 
2262
.ie n \{\
 
2263
\h'-04'\(bu\h'+03'\c
 
2264
.\}
 
2265
.el \{\
 
2266
.sp -1
 
2267
.IP \(bu 2.3
 
2268
.\}
 
2269
Lost space
 
2270
.sp
 
2271
If a row is updated to a shorter length, some space is lost\&. This is the sum of all such losses, in bytes\&.
 
2272
.RE
 
2273
.sp
 
2274
.RS 4
 
2275
.ie n \{\
 
2276
\h'-04'\(bu\h'+03'\c
 
2277
.\}
 
2278
.el \{\
 
2279
.sp -1
 
2280
.IP \(bu 2.3
 
2281
.\}
 
2282
Linkdata
 
2283
.sp
 
2284
When the dynamic table format is used, row fragments are linked with pointers (4 to 7 bytes each)\&.
 
2285
Linkdata
 
2286
is the sum of the amount of storage used by all such pointers\&.
 
2287
.RE
 
2288
.SH "MYISAMCHK MEMORY USAGE"
 
2289
.\" memory usage: myisamchk
 
2290
.PP
 
2291
Memory allocation is important when you run
 
2292
\fBmyisamchk\fR\&.
 
2293
\fBmyisamchk\fR
 
2294
uses no more memory than its memory\-related variables are set to\&. If you are going to use
 
2295
\fBmyisamchk\fR
 
2296
on very large tables, you should first decide how much memory you want it to use\&. The default is to use only about 3MB to perform repairs\&. By using larger values, you can get
 
2297
\fBmyisamchk\fR
 
2298
to operate faster\&. For example, if you have more than 512MB RAM available, you could use options such as these (in addition to any other options you might specify):
 
2299
.sp
 
2300
.if n \{\
 
2301
.RS 4
 
2302
.\}
 
2303
.nf
 
2304
shell> \fBmyisamchk \-\-myisam_sort_buffer_size=256M \e\fR
 
2305
           \fB\-\-key_buffer_size=512M \e\fR
 
2306
           \fB\-\-read_buffer_size=64M \e\fR
 
2307
           \fB\-\-write_buffer_size=64M \&.\&.\&.\fR
 
2308
.fi
 
2309
.if n \{\
 
2310
.RE
 
2311
.\}
 
2312
.PP
 
2313
Using
 
2314
\fB\-\-myisam_sort_buffer_size=16M\fR
 
2315
is probably enough for most cases\&.
 
2316
.PP
 
2317
Be aware that
 
2318
\fBmyisamchk\fR
 
2319
uses temporary files in
 
2320
TMPDIR\&. If
 
2321
TMPDIR
 
2322
points to a memory file system, out of memory errors can easily occur\&. If this happens, run
 
2323
\fBmyisamchk\fR
 
2324
with the
 
2325
\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR
 
2326
option to specify a directory located on a file system that has more space\&.
 
2327
.PP
 
2328
When performing repair operations,
 
2329
\fBmyisamchk\fR
 
2330
also needs a lot of disk space:
 
2331
.sp
 
2332
.RS 4
 
2333
.ie n \{\
 
2334
\h'-04'\(bu\h'+03'\c
 
2335
.\}
 
2336
.el \{\
 
2337
.sp -1
 
2338
.IP \(bu 2.3
 
2339
.\}
 
2340
Twice the size of the data file (the original file and a copy)\&. This space is not needed if you do a repair with
 
2341
\fB\-\-quick\fR; in this case, only the index file is re\-created\&.
 
2342
\fIThis space must be available on the same file system as the original data file\fR, as the copy is created in the same directory as the original\&.
 
2343
.RE
 
2344
.sp
 
2345
.RS 4
 
2346
.ie n \{\
 
2347
\h'-04'\(bu\h'+03'\c
 
2348
.\}
 
2349
.el \{\
 
2350
.sp -1
 
2351
.IP \(bu 2.3
 
2352
.\}
 
2353
Space for the new index file that replaces the old one\&. The old index file is truncated at the start of the repair operation, so you usually ignore this space\&. This space must be available on the same file system as the original data file\&.
 
2354
.RE
 
2355
.sp
 
2356
.RS 4
 
2357
.ie n \{\
 
2358
\h'-04'\(bu\h'+03'\c
 
2359
.\}
 
2360
.el \{\
 
2361
.sp -1
 
2362
.IP \(bu 2.3
 
2363
.\}
 
2364
When using
 
2365
\fB\-\-recover\fR
 
2366
or
 
2367
\fB\-\-sort\-recover\fR
 
2368
(but not when using
 
2369
\fB\-\-safe\-recover\fR), you need space on disk for sorting\&. This space is allocated in the temporary directory (specified by
 
2370
TMPDIR
 
2371
or
 
2372
\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR)\&. The following formula yields the amount of space required:
 
2373
.sp
 
2374
.if n \{\
 
2375
.RS 4
 
2376
.\}
 
2377
.nf
 
2378
(\fIlargest_key\fR + \fIrow_pointer_length\fR) * \fInumber_of_rows\fR * 2
 
2379
.fi
 
2380
.if n \{\
 
2381
.RE
 
2382
.\}
 
2383
.sp
 
2384
You can check the length of the keys and the
 
2385
\fIrow_pointer_length\fR
 
2386
with
 
2387
\fBmyisamchk \-dv \fR\fB\fItbl_name\fR\fR
 
2388
(see
 
2389
the section called \(lqOBTAINING TABLE INFORMATION WITH MYISAMCHK\(rq)\&. The
 
2390
\fIrow_pointer_length\fR
 
2391
and
 
2392
\fInumber_of_rows\fR
 
2393
values are the
 
2394
Datafile pointer
 
2395
and
 
2396
Data records
 
2397
values in the table description\&. To determine the
 
2398
\fIlargest_key\fR
 
2399
value, check the
 
2400
Key
 
2401
lines in the table description\&. The
 
2402
Len
 
2403
column indicates the number of bytes for each key part\&. For a multiple\-column index, the key size is the sum of the
 
2404
Len
 
2405
values for all key parts\&.
 
2406
.RE
 
2407
.PP
 
2408
If you have a problem with disk space during repair, you can try
 
2409
\fB\-\-safe\-recover\fR
 
2410
instead of
 
2411
\fB\-\-recover\fR\&.
 
2412
.SH "COPYRIGHT"
 
2413
.br
 
2414
.PP
 
2415
Copyright \(co 1997, 2013, Oracle and/or its affiliates. All rights reserved.
 
2416
.PP
 
2417
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.
 
2418
.PP
 
2419
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.
 
2420
.PP
 
2421
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-1301 USA or see http://www.gnu.org/licenses/.
 
2422
.sp
 
2423
.SH "SEE ALSO"
 
2424
For more information, please refer to the MySQL Reference Manual,
 
2425
which may already be installed locally and which is also available
 
2426
online at http://dev.mysql.com/doc/.
 
2427
.SH AUTHOR
 
2428
Oracle Corporation (http://dev.mysql.com/).