summaryrefslogtreecommitdiff
path: root/man/myisamchk.1
blob: e059cf11036d11b863ddbf3ef8689ddab4c5c19f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
'\" t
.\"
.TH "\FBMYISAMCHK\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.\" myisamchk
.SH "NAME"
myisamchk \- MyISAM table\-maintenance utility
.SH "SYNOPSIS"
.HP \w'\fBmyisamchk\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.\fR\ 'u
\fBmyisamchk [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.\fR
.SH "DESCRIPTION"
.PP
The
\fBmyisamchk\fR
utility gets information about your database tables or checks, repairs, or optimizes them\&.
\fBmyisamchk\fR
works with
MyISAM
tables (tables that have
\&.MYD
and
\&.MYI
files for storing data and indexes)\&.
.PP
The use of
\fBmyisamchk\fR
with partitioned tables is not supported\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBCaution\fR
.ps -1
.br
.PP
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\&.
.sp .5v
.RE
.PP
Invoke
\fBmyisamchk\fR
like this:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmyisamchk [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.\fR
.fi
.if n \{\
.RE
.\}
.PP
The
\fIoptions\fR
specify what you want
\fBmyisamchk\fR
to do\&. They are described in the following sections\&. You can also get a list of options by invoking
\fBmyisamchk \-\-help\fR\&.
.PP
With no options,
\fBmyisamchk\fR
simply checks your table as the default operation\&. To get more information or to tell
\fBmyisamchk\fR
to take corrective action, specify options as described in the following discussion\&.
.PP
\fItbl_name\fR
is the database table you want to check or repair\&. If you run
\fBmyisamchk\fR
somewhere other than in the database directory, you must specify the path to the database directory, because
\fBmyisamchk\fR
has no idea where the database is located\&. In fact,
\fBmyisamchk\fR
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\&.
.PP
You can name several tables on the
\fBmyisamchk\fR
command line if you wish\&. You can also specify a table by naming its index file (the file with the
\&.MYI
suffix)\&. This allows you to specify all tables in a directory by using the pattern
*\&.MYI\&. For example, if you are in a database directory, you can check all the
MyISAM
tables in that directory like this:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmyisamchk *\&.MYI\fR
.fi
.if n \{\
.RE
.\}
.PP
If you are not in the database directory, you can check all the tables there by specifying the path to the directory:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmyisamchk \fR\fB\fI/path/to/database_dir/\fR\fR\fB*\&.MYI\fR
.fi
.if n \{\
.RE
.\}
.PP
You can even check all tables in all databases by specifying a wildcard with the path to the MariaDB data directory:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmyisamchk \fR\fB\fI/path/to/datadir/*/*\fR\fR\fB\&.MYI\fR
.fi
.if n \{\
.RE
.\}
.PP
The recommended way to quickly check all
MyISAM
tables is:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmyisamchk \-\-silent \-\-fast \fR\fB\fI/path/to/datadir/*/*\fR\fR\fB\&.MYI\fR
.fi
.if n \{\
.RE
.\}
.PP
If you want to check all
MyISAM
tables and repair any that are corrupted, you can use the following command:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmyisamchk \-\-silent \-\-force \-\-fast \-\-update\-state \e\fR
          \fB\-\-key_buffer_size=64M \-\-sort_buffer_size=64M \e\fR
          \fB\-\-read_buffer_size=1M \-\-write_buffer_size=1M \e\fR
          \fB\fI/path/to/datadir/*/*\fR\fR\fB\&.MYI\fR
.fi
.if n \{\
.RE
.\}
.PP
This command assumes that you have more than 64MB free\&. For more information about memory allocation with
\fBmyisamchk\fR, see
the section called \(lqMYISAMCHK MEMORY USAGE\(rq\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBImportant\fR
.ps -1
.br
.PP
\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 MariaDB server while running
\fBmyisamchk\fR, or to lock all tables that
\fBmyisamchk\fR
is being used on\&.
.PP
Otherwise, when you run
\fBmyisamchk\fR, it may display the following error message:
.sp
.if n \{\
.RS 4
.\}
.nf
warning: clients are using or haven\'t closed the table properly
.fi
.if n \{\
.RE
.\}
.PP
This means that you are trying to check a table that has been updated by another program (such as the
\fBmysqld\fR
server) that hasn\'t yet closed the file or that has died without closing the file properly, which can sometimes lead to the corruption of one or more
MyISAM
tables\&.
.PP
If
\fBmysqld\fR
is running, you must force it to flush any table modifications that are still buffered in memory by using
FLUSH TABLES\&. You should then ensure that no one is using the tables while you are running
\fBmyisamchk\fR
.PP
However, the easiest way to avoid this problem is to use
CHECK TABLE
instead of
\fBmyisamchk\fR
to check tables\&.
.sp .5v
.RE
.PP
\fBmyisamchk\fR
supports the following options, which can be specified on the command line or in the
[myisamchk]
option file group\&.
.SH "MYISAMCHK GENERAL OPTIONS"
.\" options: myisamchk
.\" myisamchk: options
.PP
The options described in this section can be used for any type of table maintenance operation performed by
\fBmyisamchk\fR\&. The sections following this one describe options that pertain only to specific operations, such as table checking or repairing\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: help option
.\" help option: myisamchk
\fB\-\-help\fR,
\fB\-?\fR
.sp
Display a help message and exit\&. Options are grouped by type of operation\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: HELP option
.\" HELP option: myisamchk
\fB\-\-HELP\fR,
\fB\-H\fR
.sp
Display a help message and exit\&. Options are presented in a single list\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: debug option
.\" debug option: myisamchk
\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR,
\fB\-# \fR\fB\fIdebug_options\fR\fR
.sp
Write a debugging log\&. A typical
\fIdebug_options\fR
string is
\'d:t:o,\fIfile_name\fR\'\&. The default is
\'d:t:o,/tmp/myisamchk\&.trace\'\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: silent option
.\" silent option: myisamchk
\fB\-\-silent\fR,
\fB\-s\fR
.sp
Silent mode\&. Write output only when errors occur\&. You can use
\fB\-s\fR
twice (\fB\-ss\fR) to make
\fBmyisamchk\fR
very silent\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: verbose option
.\" verbose option: myisamchk
\fB\-\-verbose\fR,
\fB\-v\fR
.sp
Verbose mode\&. Print more information about what the program does\&. This can be used with
\fB\-d\fR
and
\fB\-e\fR\&. Use
\fB\-v\fR
multiple times (\fB\-vv\fR,
\fB\-vvv\fR) for even more output\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: version option
.\" version option: myisamchk
\fB\-\-version\fR,
\fB\-V\fR
.sp
Display version information and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: wait option
.\" wait option: myisamchk
\fB\-\-wait\fR,
\fB\-w\fR
.sp
Instead of terminating with an error if the table is locked, wait until the table is unlocked before continuing\&. If you are running
\fBmysqld\fR
with external locking disabled, the table can be locked only by another
\fBmyisamchk\fR
command\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: print argument list option
.\" print argument list option: myisamchk
\fB\-\-print\-defaults\fR
.sp
Print the program argument list and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: no defaults option
.\" no defaults option: myisamchk
\fB\-\-no\-defaults\fR
.sp
Don't read default options from any option file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: defaults file option
.\" defaults file option: myisamchk
\fB\-\-defaults\-file=#\fR
.sp
Only read default options from the given file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: defaults extrafile option
.\" defaults extra file option: myisamchk
\fB\-\-defaults\-extra\-file=#\fR
.sp
Read this file after the global files are read\&.
.RE
.PP
You can also set the following variables by using
\fB\-\-\fR\fB\fIvar_name\fR\fR\fB=\fR\fB\fIvalue\fR\fR
syntax:
.\" decode_bits myisamchk variable
.\" ft_max_word_len myisamchk variable
.\" ft_min_word_len myisamchk variable
.\" ft_stopword_file myisamchk variable
.\" key_buffer_size myisamchk variable
.\" key_cache_block_size myisamchk variable
.\" myisam_block_size myisamchk variable
.\" read_buffer_size myisamchk variable
.\" sort_buffer_size myisamchk variable
.\" sort_key_blocks myisamchk variable
.\" stats_method myisamchk variable
.\" write_buffer_size myisamchk variable
.TS
allbox tab(:);
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l.
T{
\fBVariable\fR
T}:T{
\fBDefault Value\fR
T}
T{
decode_bits
T}:T{
9
T}
T{
ft_max_word_len
T}:T{
version\-dependent
T}
T{
ft_min_word_len
T}:T{
4
T}
T{
ft_stopword_file
T}:T{
built\-in list
T}
T{
key_buffer_size
T}:T{
523264
T}
T{
key_cache_block_size
T}:T{
1024
T}
T{
myisam_block_size
T}:T{
1024
T}
T{
read_buffer_size
T}:T{
262136
T}
T{
sort_buffer_size
T}:T{
2097144
T}
T{
sort_key_blocks
T}:T{
16
T}
T{
stats_method
T}:T{
nulls_unequal
T}
T{
write_buffer_size
T}:T{
262136
T}
.TE
.sp 1
.PP
The possible
\fBmyisamchk\fR
variables and their default values can be examined with
\fBmyisamchk \-\-help\fR:
.PP
sort_buffer_size
is used when the keys are repaired by sorting keys, which is the normal case when you use
\fB\-\-recover\fR\&.
.PP
key_buffer_size
is used when you are checking the table with
\fB\-\-extend\-check\fR
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:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
You use
\fB\-\-safe\-recover\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
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
CHAR,
VARCHAR, or
TEXT
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
\fBmyisamchk\fR
to repair by sorting, you can use the
\fB\-\-sort\-recover\fR
option\&.
.RE
.PP
Repairing through the key buffer takes much less disk space than using sorting, but is also much slower\&.
.PP
If you want a faster repair, set the
key_buffer_size
and
sort_buffer_size
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\&.
.PP
myisam_block_size
is the size used for index blocks\&.
.PP
stats_method
influences how
NULL
values are treated for index statistics collection when the
\fB\-\-analyze\fR
option is given\&. It acts like the
myisam_stats_method
system variable\&. For more information, see the description of
myisam_stats_method
in
Section\ \&5.1.4, \(lqServer System Variables\(rq, and
Section\ \&7.4.7, \(lqMyISAM Index Statistics Collection\(rq\&.
.PP
ft_min_word_len
and
ft_max_word_len
indicate the minimum and maximum word length for
FULLTEXT
indexes\&.
ft_stopword_file
names the stopword file\&. These need to be set under the following circumstances\&.
.PP
If you use
\fBmyisamchk\fR
to perform an operation that modifies table indexes (such as repair or analyze), the
FULLTEXT
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\&.
.PP
The problem occurs because these parameters are known only by the server\&. They are not stored in
MyISAM
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
ft_min_word_len,
ft_max_word_len, and
ft_stopword_file
values to
\fBmyisamchk\fR
that you use for
\fBmysqld\fR\&. For example, if you have set the minimum word length to 3, you can repair a table with
\fBmyisamchk\fR
like this:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmyisamchk \-\-recover \-\-ft_min_word_len=3 \fR\fB\fItbl_name\fR\fR\fB\&.MYI\fR
.fi
.if n \{\
.RE
.\}
.PP
To ensure that
\fBmyisamchk\fR
and the server use the same values for full\-text parameters, you can place each one in both the
[mysqld]
and
[myisamchk]
sections of an option file:
.sp
.if n \{\
.RS 4
.\}
.nf
[mysqld]
ft_min_word_len=3
[myisamchk]
ft_min_word_len=3
.fi
.if n \{\
.RE
.\}
.PP
An alternative to using
\fBmyisamchk\fR
is to use the
REPAIR TABLE,
ANALYZE TABLE,
OPTIMIZE TABLE, or
ALTER TABLE\&. These statements are performed by the server, which knows the proper full\-text parameter values to use\&.
.SH "MYISAMCHK CHECK OPTIONS"
.\" check options: myisamchk
.\" tables: checking
.PP
\fBmyisamchk\fR
supports the following options for table checking operations:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: check option
.\" check option: myisamchk
\fB\-\-check\fR,
\fB\-c\fR
.sp
Check the table for errors\&. This is the default operation if you specify no option that selects an operation type explicitly\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: check-only-changed option
.\" check-only-changed option: myisamchk
\fB\-\-check\-only\-changed\fR,
\fB\-C\fR
.sp
Check only tables that have changed since the last check\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: extend-check option
.\" extend-check option: myisamchk
\fB\-\-extend\-check\fR,
\fB\-e\fR
.sp
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,
\fBmyisamchk\fR
or
\fBmyisamchk \-\-medium\-check\fR
should be able to determine whether there are any errors in the table\&.
.sp
If you are using
\fB\-\-extend\-check\fR
and have plenty of memory, setting the
key_buffer_size
variable to a large value helps the repair operation run faster\&.
.sp
For a description of the output format, see
the section called \(lqMYISAMCHK TABLE INFORMATION\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: fast option
.\" fast option: myisamchk
\fB\-\-fast\fR,
\fB\-F\fR
.sp
Check only tables that haven\'t been closed properly\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: force option
.\" force option: myisamchk
\fB\-\-force\fR,
\fB\-f\fR
.sp
Do a repair operation automatically if
\fBmyisamchk\fR
finds any errors in the table\&. The repair type is the same as that specified with the
\fB\-\-recover\fR
or
\fB\-r\fR
option\&. States will be updated as with 
\fB\-\-update\-state\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: information option
.\" information option: myisamchk
\fB\-\-information\fR,
\fB\-i\fR
.sp
Print informational statistics about the table that is checked\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: medium-check option
.\" medium-check option: myisamchk
\fB\-\-medium\-check\fR,
\fB\-m\fR
.sp
Do a check that is faster than an
\fB\-\-extend\-check\fR
operation\&. This finds only 99\&.99% of all errors, which should be good enough in most cases\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: read-only option
.\" read-only option: myisamchk
\fB\-\-read\-only\fR,
\fB\-T\fR
.sp
Do not mark the table as checked\&. This is useful if you use
\fBmyisamchk\fR
to check a table that is in use by some other application that does not use locking, such as
\fBmysqld\fR
when run with external locking disabled\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: update-state option
.\" update-state option: myisamchk
\fB\-\-update\-state\fR,
\fB\-U\fR
.sp
Store information in the
\&.MYI
file to indicate when the table was checked and whether the table crashed\&. This should be used to get full benefit of the
\fB\-\-check\-only\-changed\fR
option, but you shouldn\'t use this option if the
\fBmysqld\fR
server is using the table and you are running it with external locking disabled\&.
.RE
.SH "MYISAMCHK REPAIR OPTIONS"
.\" repair options: myisamchk
.\" files: repairing
.PP
\fBmyisamchk\fR
supports the following options for table repair operations (operations performed when an option such as
\fB\-\-recover\fR
or
\fB\-\-safe\-recover\fR
is given):
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: backup option
.\" backup option: myisamchk
\fB\-\-backup\fR,
\fB\-B\fR
.sp
Make a backup of the
\&.MYD
file as
\fIfile_name\fR\-\fItime\fR\&.BAK
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: character-sets-dir option
.\" character-sets-dir option: myisamchk
\fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR
.sp
The directory where character sets are installed\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: correct-checksum option
.\" correct-checksum option: myisamchk
\fB\-\-correct\-checksum\fR
.sp
Correct the checksum information for the table\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: create-missing-keys option
.\" create-missing-keys option: myisamchk
\fB\-\-create\-missing\-keys\fR
.sp
Create missing keys. This assumes that the data file is correct and that the 
number of rows stored in the index file is correct\&. Enables 
\fB\-\-quick\fR\&.

.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: data-file-length option
.\" data-file-length option: myisamchk
\fB\-\-data\-file\-length=\fR\fB\fIlen\fR\fR,
\fB\-D \fR\fB\fIlen\fR\fR
.sp
The maximum length of the data file (when re\-creating data file when it is
\(lqfull\(rq)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: extend-check option
.\" extend-check option: myisamchk
\fB\-\-extend\-check\fR,
\fB\-e\fR
.sp
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\&.
.sp
For a description of the output format, see
the section called \(lqMYISAMCHK TABLE INFORMATION\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: force option
.\" force option: myisamchk
\fB\-\-force\fR,
\fB\-f\fR
.sp
Overwrite old intermediate files (files with names like
\fItbl_name\fR\&.TMD) instead of aborting\&. Add another
\fB\-\-force\fR
to avoid 'myisam_sort_buffer_size is too small' errors\&. In this case 
we will attempt to do the repair with the given 
\fBmyisam_sort_buffer_size\fR
and dynamically allocate as many management buffers as needed\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: keys-used option
.\" keys-used option: myisamchk
\fB\-\-keys\-used=\fR\fB\fIval\fR\fR,
\fB\-k \fR\fB\fIval\fR\fR
.sp
For
\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
\fBmyisamchk \-r\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: max-record-length option
.\" max-record-length option: myisamchk
\fB\-\-max\-record\-length=\fR\fB\fIlen\fR\fR
.sp
Skip rows larger than the given length if
\fBmyisamchk\fR
cannot allocate memory to hold them\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: parallel-recover option
.\" parallel-recover option: myisamchk
\fB\-\-parallel\-recover\fR,
\fB\-p\fR
.sp
Use the same technique as
\fB\-r\fR
and
\fB\-n\fR, but create all the keys in parallel, using different threads\&.
\fIThis is beta\-quality code\&. Use at your own risk!\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: quick option
.\" quick option: myisamchk
\fB\-\-quick\fR,
\fB\-q\fR
.sp
Achieve a faster repair by modifying only the index file, not the data file\&. You can specify this option twice to force
\fBmyisamchk\fR
to modify the original data file in case of duplicate keys\&. NOTE: Tables where the data file is corrupted can't be fixed with this option\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: recover option
.\" recover option: myisamchk
\fB\-\-recover\fR,
\fB\-r\fR
.sp
Do a repair that can fix almost any problem except unique keys that are not unique (which is an extremely unlikely error with
MyISAM
tables)\&. If you want to recover a table, this is the option to try first\&. You should try
\fB\-\-safe\-recover\fR
only if
\fBmyisamchk\fR
reports that the table cannot be recovered using
\fB\-\-recover\fR\&. (In the unlikely case that
\fB\-\-recover\fR
fails, the data file remains intact\&.)
.sp
If you have lots of memory, you should increase the value of
sort_buffer_size\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: safe-recover option
.\" safe-recover option: myisamchk
\fB\-\-safe\-recover\fR,
\fB\-o\fR
.sp
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
\fB\-\-recover\fR, but can handle a couple of very unlikely cases that
\fB\-\-recover\fR
cannot\&. This recovery method also uses much less disk space than
\fB\-\-recover\fR\&. Normally, you should repair first using
\fB\-\-recover\fR, and then with
\fB\-\-safe\-recover\fR
only if
\fB\-\-recover\fR
fails\&.
.sp
If you have lots of memory, you should increase the value of
key_buffer_size\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: set-collation option
.\" set-collation option: myisamchk
\fB\-\-set\-collation=\fR\fB\fIname\fR\fR
.sp
Specify the collation to use for sorting table indexes\&. The character set name is implied by the first part of the collation name\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: sort-recover option
.\" sort-recover option: myisamchk
\fB\-\-sort\-recover\fR,
\fB\-n\fR
.sp
Force
\fBmyisamchk\fR
to use sorting to resolve the keys even if the temporary files would be very large\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: tmpdir option
.\" tmpdir option: myisamchk
\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR,
\fB\-t \fR\fB\fIpath\fR\fR
.sp
The path of the directory to be used for storing temporary files\&. If this is not set,
\fBmyisamchk\fR
uses the value of the
TMPDIR
environment variable\&.
tmpdir
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, NetWare, and OS/2\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: unpack option
.\" unpack option: myisamchk
\fB\-\-unpack\fR,
\fB\-u\fR
.sp
Unpack a table that was packed with
\fBmyisampack\fR\&.
.RE
.SH "OTHER MYISAMCHK OPTIONS"
.PP
\fBmyisamchk\fR
supports the following options for actions other than table checks and repairs:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: analyze option
.\" analyze option: myisamchk
\fB\-\-analyze\fR,
\fB\-a\fR
.sp
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
\fBmyisamchk \-\-description \-\-verbose \fR\fB\fItbl_name\fR\fR
command or the
SHOW INDEX FROM \fItbl_name\fR
statement\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: block-search option
.\" block-search option: myisamchk
\fB\-\-block\-search=\fR\fB\fIoffset\fR\fR,
\fB\-b \fR\fB\fIoffset\fR\fR
.sp
Find the record that a block at the given offset belongs to\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: description option
.\" description option: myisamchk
\fB\-\-description\fR,
\fB\-d\fR
.sp
Print some descriptive information about the table\&. Specifying the
\fB\-\-verbose\fR
option once or twice produces additional information\&. See
the section called \(lqMYISAMCHK TABLE INFORMATION\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: set-auto-increment[ option
.\" set-auto-increment[ option: myisamchk
\fB\-\-set\-auto\-increment[=\fR\fB\fIvalue\fR\fR\fB]\fR,
\fB\-A[\fR\fB\fIvalue\fR\fR\fB]\fR
.sp
Force
AUTO_INCREMENT
numbering for new records to start at the given value (or higher, if there are existing records with
AUTO_INCREMENT
values this large)\&. If
\fIvalue\fR
is not specified,
AUTO_INCREMENT
numbers for new records begin with the largest value currently in the table, plus one\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: sort-index option
.\" sort-index option: myisamchk
\fB\-\-sort\-index\fR,
\fB\-S\fR
.sp
Sort the index tree blocks in high\-low order\&. This optimizes seeks and makes table scans that use indexes faster\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: sort-records option
.\" sort-records option: myisamchk
\fB\-\-sort\-records=\fR\fB\fIN\fR\fR,
\fB\-R \fR\fB\fIN\fR\fR
.sp
Sort records according to a particular index\&. This makes your data much more localized and may speed up range\-based
SELECT
and
ORDER BY
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\'s index numbers, use
SHOW INDEX, which displays a table\'s indexes in the same order that
\fBmyisamchk\fR
sees them\&. Indexes are numbered beginning with 1\&.
.sp
If keys are not packed (PACK_KEYS=0), they have the same length, so when
\fBmyisamchk\fR
sorts and moves records, it just overwrites record offsets in the index\&. If keys are packed (PACK_KEYS=1),
\fBmyisamchk\fR
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\&.)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" myisamchk: stats_method option
.\" stats_method option: myisamchk
\fB\-\-stats\-method=name\fR
.sp
Specifies how index statistics collection code should treat NULLs\&. Possible values 
of name are "nulls_unequal" (default), "nulls_equal" (emulate MySQL 4 behavior), and "nulls_ignored"\&.
.RE
.SH "MYISAMCHK TABLE INFORMATION"
.\" table description: myisamchk
.\" tables: information
.\" examples: myisamchk output
.\" myisamchk: example output
.PP
To obtain a description of a
MyISAM
table or statistics about it, use the commands shown here\&. The output from these commands is explained later in this section\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBmyisamchk \-d \fR\fB\fItbl_name\fR\fR
.sp
Runs
\fBmyisamchk\fR
in
\(lqdescribe mode\(rq
to produce a description of your table\&. If you start the MariaDB server with external locking disabled,
\fBmyisamchk\fR
may report an error for a table that is updated while it runs\&. However, because
\fBmyisamchk\fR
does not change the table in describe mode, there is no risk of destroying data\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBmyisamchk \-dv \fR\fB\fItbl_name\fR\fR
.sp
Adding
\fB\-v\fR
runs
\fBmyisamchk\fR
in verbose mode so that it produces more information about the table\&. Adding
\fB\-v\fR
a second time produces even more information\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBmyisamchk \-eis \fR\fB\fItbl_name\fR\fR
.sp
Shows only the most important information from a table\&. This operation is slow because it must read the entire table\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBmyisamchk \-eiv \fR\fB\fItbl_name\fR\fR
.sp
This is like
\fB\-eis\fR, but tells you what is being done\&.
.RE
.PP
The
\fItbl_name\fR
argument can be either the name of a
MyISAM
table or the name of its index file, as described in
\fBmyisamchk\fR(1)\&. Multiple
\fItbl_name\fR
arguments can be given\&.
.PP
Suppose that a table named
person
has the following structure\&. (The
MAX_ROWS
table option is included so that in the example output from
\fBmyisamchk\fR
shown later, some values are smaller and fit the output format more easily\&.)
.sp
.if n \{\
.RS 4
.\}
.nf
CREATE TABLE person
(
  id         INT NOT NULL AUTO_INCREMENT,
  last_name  VARCHAR(20) NOT NULL,
  first_name VARCHAR(20) NOT NULL,
  birth      DATE,
  death      DATE,
  PRIMARY KEY (id),
  INDEX (last_name, first_name),
  INDEX (birth)
) MAX_ROWS = 1000000;
.fi
.if n \{\
.RE
.\}
.PP
Suppose also that the table has these data and index file sizes:
.sp
.if n \{\
.RS 4
.\}
.nf
\-rw\-rw\-\-\-\-  1 mysql  mysql  9347072 Aug 19 11:47 person\&.MYD
\-rw\-rw\-\-\-\-  1 mysql  mysql  6066176 Aug 19 11:47 person\&.MYI
.fi
.if n \{\
.RE
.\}
.PP
Example of
\fBmyisamchk \-dvv\fR
output:
.sp
.if n \{\
.RS 4
.\}
.nf
MyISAM file:         person
Record format:       Packed
Character set:       latin1_swedish_ci (8)
File\-version:        1
Creation time:       2009\-08\-19 16:47:41
Recover time:        2009\-08\-19 16:47:56
Status:              checked,analyzed,optimized keys
Auto increment key:              1  Last value:                306688
Data records:               306688  Deleted blocks:                 0
Datafile parts:             306688  Deleted data:                   0
Datafile pointer (bytes):        4  Keyfile pointer (bytes):        3
Datafile length:           9347072  Keyfile length:           6066176
Max datafile length:    4294967294  Max keyfile length:   17179868159
Recordlength:                   54
table description:
Key Start Len Index   Type                 Rec/key         Root  Blocksize
1   2     4   unique  long                       1        99328       1024
2   6     20  multip\&. varchar prefix           512      3563520       1024
    27    20          varchar                  512
3   48    3   multip\&. uint24 NULL           306688      6065152       1024
Field Start Length Nullpos Nullbit Type
1     1     1
2     2     4                      no zeros
3     6     21                     varchar
4     27    21                     varchar
5     48    3      1       1       no zeros
6     51    3      1       2       no zeros
.fi
.if n \{\
.RE
.\}
.PP
Explanations for the types of information
\fBmyisamchk\fR
produces are given here\&.
\(lqKeyfile\(rq
refers to the index file\&.
\(lqRecord\(rq
and
\(lqrow\(rq
are synonymous, as are
\(lqfield\(rq
and
\(lqcolumn\&.\(rq
.PP
The initial part of the table description contains these values:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
MyISAM file
.sp
Name of the
MyISAM
(index) file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Record format
.sp
The format used to store table rows\&. The preceding examples use
Fixed length\&. Other possible values are
Compressed
and
Packed\&. (Packed
corresponds to what
SHOW TABLE STATUS
reports as
Dynamic\&.)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Chararacter set
.sp
The table default character set\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
File\-version
.sp
Version of
MyISAM
format\&. Currently always 1\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Creation time
.sp
When the data file was created\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Recover time
.sp
When the index/data file was last reconstructed\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Status
.sp
Table status flags\&. Possible values are
crashed,
open,
changed,
analyzed,
optimized keys, and
sorted index pages\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Auto increment key,
Last value
.sp
The key number associated the table\'s
AUTO_INCREMENT
column, and the most recently generated value for this column\&. These fields do not appear if there is no such column\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Data records
.sp
The number of rows in the table\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Deleted blocks
.sp
How many deleted blocks still have reserved space\&. You can optimize your table to minimize this space\&. See
Section\ \&6.6.4, \(lqMyISAM Table Optimization\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Datafile parts
.sp
For dynamic\-row format, this indicates how many data blocks there are\&. For an optimized table without fragmented rows, this is the same as
Data records\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Deleted data
.sp
How many bytes of unreclaimed deleted data there are\&. You can optimize your table to minimize this space\&. See
Section\ \&6.6.4, \(lqMyISAM Table Optimization\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Datafile pointer
.sp
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 MariaDB yet\&. For fixed tables, this is a row address\&. For dynamic tables, this is a byte address\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Keyfile pointer
.sp
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 MariaDB\&. It is always a block address\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Max datafile length
.sp
How long the table data file can become, in bytes\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Max keyfile length
.sp
How long the table index file can become, in bytes\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Recordlength
.sp
How much space each row takes, in bytes\&.
.RE
.PP
The
table description
part of the output includes a list of all keys in the table\&. For each key,
\fBmyisamchk\fR
displays some low\-level information:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Key
.sp
This key\'s 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
table description
lines for the second index\&. This indicates that it is a multiple\-part index with two parts\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Start
.sp
Where in the row this portion of the index starts\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Len
.sp
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
Len
values for all key parts\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Index
.sp
Whether a key value can exist multiple times in the index\&. Possible values are
unique
or
multip\&.
(multiple)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Type
.sp
What data type this portion of the index has\&. This is a
MyISAM
data type with the possible values
packed,
stripped, or
empty\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Root
.sp
Address of the root index block\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Blocksize
.sp
The size of each index block\&. By default this is 1024, but the value may be changed at compile time when MariaDB is built from source\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Rec/key
.sp
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
\fBmyisamchk \-a\fR\&. If this is not updated at all, a default value of 30 is given\&.
.RE
.PP
The last part of the output provides information about each column:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Field
.sp
The column number\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Start
.sp
The byte position of the column within table rows\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Length
.sp
The length of the column in bytes\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Nullpos,
Nullbit
.sp
For columns that can be
NULL,
MyISAM
stores
NULL
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
Nullpos
and
Nullbit
values, if nonempty, indicate which byte and bit contains that flag indicating whether the column is
NULL\&.
.sp
The position and number of bytes used to store
NULL
flags is shown in the line for field 1\&. This is why there are six
Field
lines for the
person
table even though it has only five columns\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Type
.sp
The data type\&. The value may contain any of the following descriptors:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
constant
.sp
All rows have the same value\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
no endspace
.sp
Do not store endspace\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
no endspace, not_always
.sp
Do not store endspace and do not do endspace compression for all values\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
no endspace, no empty
.sp
Do not store endspace\&. Do not store empty values\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
table\-lookup
.sp
The column was converted to an
ENUM\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
zerofill(\fIN\fR)
.sp
The most significant
\fIN\fR
bytes in the value are always 0 and are not stored\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
no zeros
.sp
Do not store zeros\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
always zero
.sp
Zero values are stored using one bit\&.
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Huff tree
.sp
The number of the Huffman tree associated with the column\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Bits
.sp
The number of bits used in the Huffman tree\&.
.RE
.PP
The
Huff tree
and
Bits
fields are displayed if the table has been compressed with
\fBmyisampack\fR\&. See
\fBmyisampack\fR(1), for an example of this information\&.
.PP
Example of
\fBmyisamchk \-eiv\fR
output:
.sp
.if n \{\
.RS 4
.\}
.nf
Checking MyISAM file: person
Data records:  306688   Deleted blocks:       0
\- check file\-size
\- check record delete\-chain
No recordlinks
\- check key delete\-chain
block_size 1024:
\- check index reference
\- check data record references index: 1
Key:  1:  Keyblocks used:  98%  Packed:    0%  Max levels:  3
\- check data record references index: 2
Key:  2:  Keyblocks used:  99%  Packed:   97%  Max levels:  3
\- check data record references index: 3
Key:  3:  Keyblocks used:  98%  Packed:  \-14%  Max levels:  3
Total:    Keyblocks used:  98%  Packed:   89%
\- check records and index references
\fI*** LOTS OF ROW NUMBERS DELETED ***\fR
Records:            306688  M\&.recordlength:       25  Packed:            83%
Recordspace used:       97% Empty space:           2% Blocks/Record:   1\&.00
Record blocks:      306688  Delete blocks:         0
Record data:       7934464  Deleted data:          0
Lost space:         256512  Linkdata:        1156096
User time 43\&.08, System time 1\&.68
Maximum resident set size 0, Integral resident set size 0
Non\-physical pagefaults 0, Physical pagefaults 0, Swaps 0
Blocks in 0 out 7, Messages in 0 out 0, Signals 0
Voluntary context switches 0, Involuntary context switches 0
Maximum memory usage: 1046926 bytes (1023k)
.fi
.if n \{\
.RE
.\}
.PP
\fBmyisamchk \-eiv\fR
output includes the following information:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Data records
.sp
The number of rows in the table\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Deleted blocks
.sp
How many deleted blocks still have reserved space\&. You can optimize your table to minimize this space\&. See
Section\ \&6.6.4, \(lqMyISAM Table Optimization\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Key
.sp
The key number\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Keyblocks used
.sp
What percentage of the keyblocks are used\&. When a table has just been reorganized with
\fBmyisamchk\fR, the values are very high (very near theoretical maximum)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Packed
.sp
MariaDB tries to pack key values that have a common suffix\&. This can only be used for indexes on
CHAR
and
VARCHAR
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\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Max levels
.sp
How deep the B\-tree for this key is\&. Large tables with long key values get high values\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Records
.sp
How many rows are in the table\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
M\&.recordlength
.sp
The average row length\&. This is the exact row length for tables with fixed\-length rows, because all rows have the same length\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Packed
.sp
MariaDB strips spaces from the end of strings\&. The
Packed
value indicates the percentage of savings achieved by doing this\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Recordspace used
.sp
What percentage of the data file is used\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Empty space
.sp
What percentage of the data file is unused\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Blocks/Record
.sp
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
Section\ \&6.6.4, \(lqMyISAM Table Optimization\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Recordblocks
.sp
How many blocks (links) are used\&. For fixed\-format tables, this is the same as the number of rows\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Deleteblocks
.sp
How many blocks (links) are deleted\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Recorddata
.sp
How many bytes in the data file are used\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Deleted data
.sp
How many bytes in the data file are deleted (unused)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Lost space
.sp
If a row is updated to a shorter length, some space is lost\&. This is the sum of all such losses, in bytes\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Linkdata
.sp
When the dynamic table format is used, row fragments are linked with pointers (4 to 7 bytes each)\&.
Linkdata
is the sum of the amount of storage used by all such pointers\&.
.RE
.SH "MYISAMCHK MEMORY USAGE"
.\" memory usage: myisamchk
.PP
Memory allocation is important when you run
\fBmyisamchk\fR\&.
\fBmyisamchk\fR
uses no more memory than its memory\-related variables are set to\&. If you are going to use
\fBmyisamchk\fR
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
\fBmyisamchk\fR
to operate faster\&. For example, if you have more than 32MB RAM, you could use options such as these (in addition to any other options you might specify):
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmyisamchk \-\-sort_buffer_size=16M \e\fR
           \fB\-\-key_buffer_size=16M \e\fR
           \fB\-\-read_buffer_size=1M \e\fR
           \fB\-\-write_buffer_size=1M \&.\&.\&.\fR
.fi
.if n \{\
.RE
.\}
.PP
Using
\fB\-\-sort_buffer_size=16M\fR
should probably be enough for most cases\&.
.PP
Be aware that
\fBmyisamchk\fR
uses temporary files in
TMPDIR\&. If
TMPDIR
points to a memory file system, out of memory errors can easily occur\&. If this happens, run
\fBmyisamchk\fR
with the
\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR
option to specify a directory located on a file system that has more space\&.
.PP
When performing repair operations,
\fBmyisamchk\fR
also needs a lot of disk space:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Twice the size of the data file (the original file and a copy)\&. This space is not needed if you do a repair with
\fB\-\-quick\fR; in this case, only the index file is re\-created\&.
\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\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
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\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
When using
\fB\-\-recover\fR
or
\fB\-\-sort\-recover\fR
(but not when using
\fB\-\-safe\-recover\fR), you need space on disk for sorting\&. This space is allocated in the temporary directory (specified by
TMPDIR
or
\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR)\&. The following formula yields the amount of space required:
.sp
.if n \{\
.RS 4
.\}
.nf
(\fIlargest_key\fR + \fIrow_pointer_length\fR) \(mu \fInumber_of_rows\fR \(mu 2
.fi
.if n \{\
.RE
.\}
.sp
You can check the length of the keys and the
\fIrow_pointer_length\fR
with
\fBmyisamchk \-dv \fR\fB\fItbl_name\fR\fR
(see
the section called \(lqMYISAMCHK TABLE INFORMATION\(rq)\&. The
\fIrow_pointer_length\fR
and
\fInumber_of_rows\fR
values are the
Datafile pointer
and
Data records
values in the table description\&. To determine the
\fIlargest_key\fR
value, check the
Key
lines in the table description\&. The
Len
column indicates the number of bytes for each key part\&. For a multiple\-column index, the key size is the sum of the
Len
values for all key parts\&.
.RE
.PP
If you have a problem with disk space during repair, you can try
\fB\-\-safe\-recover\fR
instead of
\fB\-\-recover\fR\&.
.SH "COPYRIGHT"
.br
.PP
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation
.PP
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.
.PP
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.
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA or see http://www.gnu.org/licenses/.
.sp
.SH "SEE ALSO"
For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
.SH AUTHOR
MariaDB Foundation (http://www.mariadb.org/).