~ubuntu-branches/ubuntu/wily/mysql-5.6/wily

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