2009-09-16 14:03:18 +02:00
'\" t
2009-05-25 11:59:47 +02:00
. \"
2020-05-15 17:35:47 +02:00
.TH "\FBMYISAMCHK\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
2009-09-16 14:03:18 +02:00
. \" -----------------------------------------------------------------
. \" * set default formatting
. \" -----------------------------------------------------------------
2009-05-25 11:59:47 +02:00
. \" disable hyphenation
.nh
. \" disable justification (adjust text to left margin only)
.ad l
2009-09-16 14:03:18 +02:00
. \" -----------------------------------------------------------------
. \" * MAIN CONTENT STARTS HERE *
. \" -----------------------------------------------------------------
. \" myisamchk
2009-05-25 11:59:47 +02:00
.SH "NAME"
myisamchk \- MyISAM table\- maintenance utility
.SH "SYNOPSIS"
2009-09-16 14:03:18 +02:00
.HP \w '\fBmyisamchk\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR \fB \fI tbl_name\fR\fR\fB\ \& .\&.\&.\fR\ 'u
\fB myisamchk [\fR \fB \fI options\fR \fR \fB ] \fR \fB \fI tbl_name\fR \fR \fB \& .\& .\& .\fR
2009-05-25 11:59:47 +02:00
.SH "DESCRIPTION"
.PP
The
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
utility gets information about your database tables or checks, repairs, or optimizes them\& .
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
works with
MyISAM
tables (tables that have
2009-09-16 14:03:18 +02:00
\& .MYD
2009-05-25 11:59:47 +02:00
and
2009-09-16 14:03:18 +02:00
\& .MYI
files for storing data and indexes)\& .
2009-05-25 11:59:47 +02:00
.PP
The use of
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
with partitioned tables is not supported\& .
.if n \{ \
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
. \}
.RS 4
2009-05-25 11:59:47 +02:00
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
2009-09-16 14:03:18 +02:00
.ps +1
2009-05-25 11:59:47 +02:00
\fB Caution\fR
2009-09-16 14:03:18 +02:00
.ps -1
.br
2009-05-25 11:59:47 +02:00
.PP
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
.PP
Invoke
\fB myisamchk\fR
like this:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
shell> \fB myisamchk [\fR \fB \fI options\fR \fR \fB ] \fR \fB \fI tbl_name\fR \fR \fB \& .\& .\& .\fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
The
\fI options\fR
specify what you want
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
to do\& . They are described in the following sections\& . You can also get a list of options by invoking
\fB myisamchk \- \- help\fR \& .
2009-05-25 11:59:47 +02:00
.PP
With no options,
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
simply checks your table as the default operation\& . To get more information or to tell
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
to take corrective action, specify options as described in the following discussion\& .
2009-05-25 11:59:47 +02:00
.PP
\fI tbl_name\fR
2009-09-16 14:03:18 +02:00
is the database table you want to check or repair\& . If you run
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
somewhere other than in the database directory, you must specify the path to the database directory, because
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
has no idea where the database is located\& . In fact,
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
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\& .
2009-05-25 11:59:47 +02:00
.PP
You can name several tables on the
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
MyISAM
tables in that directory like this:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
shell> \fB myisamchk *\& .MYI\fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
If you are not in the database directory, you can check all the tables there by specifying the path to the directory:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
shell> \fB myisamchk \fR \fB \fI /path/to/database_dir/\fR \fR \fB *\& .MYI\fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
2015-09-09 14:32:52 +02:00
You can even check all tables in all databases by specifying a wildcard with the path to the MariaDB data directory:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
shell> \fB myisamchk \fR \fB \fI /path/to/datadir/*/*\fR \fR \fB \& .MYI\fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
The recommended way to quickly check all
MyISAM
tables is:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
shell> \fB myisamchk \- \- silent \- \- fast \fR \fB \fI /path/to/datadir/*/*\fR \fR \fB \& .MYI\fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
If you want to check all
MyISAM
tables and repair any that are corrupted, you can use the following command:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
shell> \fB myisamchk \- \- 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
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
2009-09-16 14:03:18 +02:00
This command assumes that you have more than 64MB free\& . For more information about memory allocation with
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR , see
2009-09-16 14:03:18 +02:00
the section called \(lq MYISAMCHK MEMORY USAGE\(rq \& .
.if n \{ \
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
. \}
.RS 4
2009-05-25 11:59:47 +02:00
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
2009-09-16 14:03:18 +02:00
.ps +1
2009-05-25 11:59:47 +02:00
\fB Important\fR
2009-09-16 14:03:18 +02:00
.ps -1
.br
2009-05-25 11:59:47 +02:00
.PP
2015-09-09 14:32:52 +02:00
\fI You must ensure that no other program is using the tables while you are running \fR \fI \fB myisamchk\fR \fR \& . The most effective means of doing so is to shut down the MariaDB server while running
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR , or to lock all tables that
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
is being used on\& .
2009-05-25 11:59:47 +02:00
.PP
Otherwise, when you run
\fB myisamchk\fR , it may display the following error message:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
warning: clients are using or haven\' t closed the table properly
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
This means that you are trying to check a table that has been updated by another program (such as the
\fB mysqld\fR
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
MyISAM
2009-09-16 14:03:18 +02:00
tables\& .
2009-05-25 11:59:47 +02:00
.PP
If
\fB mysqld\fR
is running, you must force it to flush any table modifications that are still buffered in memory by using
2009-09-16 14:03:18 +02:00
FLUSH TABLES\& . You should then ensure that no one is using the tables while you are running
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
.PP
However, the easiest way to avoid this problem is to use
CHECK TABLE
instead of
\fB myisamchk\fR
2015-09-09 14:32:52 +02:00
to check tables\& .
2009-09-16 14:03:18 +02:00
.sp .5v
.RE
2009-05-25 11:59:47 +02:00
.PP
\fB myisamchk\fR
2010-04-28 15:06:11 +02:00
supports the following options, which can be specified on the command line or in the
[myisamchk]
option file group\& .
2009-09-16 14:03:18 +02:00
.SH "MYISAMCHK GENERAL OPTIONS"
. \" options: myisamchk
. \" myisamchk: options
2009-05-25 11:59:47 +02:00
.PP
The options described in this section can be used for any type of table maintenance operation performed by
2009-09-16 14:03:18 +02:00
\fB myisamchk\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
2009-05-25 11:59:47 +02:00
\fB \- \- help\fR ,
\fB \- ?\fR
.sp
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- HELP\fR ,
\fB \- H\fR
.sp
2009-09-16 14:03:18 +02:00
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
2009-12-01 08:24:05 +01:00
\fB \- \- debug=\fR \fB \fI debug_options\fR \fR ,
\fB \- # \fR \fB \fI debug_options\fR \fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Write a debugging log\& . A typical
2009-05-25 11:59:47 +02:00
\fI debug_options\fR
2009-09-16 14:03:18 +02:00
string is
\' d:t:o,\fI file_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
2009-05-25 11:59:47 +02:00
\fB \- \- silent\fR ,
\fB \- s\fR
.sp
2009-09-16 14:03:18 +02:00
Silent mode\& . Write output only when errors occur\& . You can use
2009-05-25 11:59:47 +02:00
\fB \- s\fR
twice (\fB \- ss\fR ) to make
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- verbose\fR ,
\fB \- v\fR
.sp
2009-09-16 14:03:18 +02:00
Verbose mode\& . Print more information about what the program does\& . This can be used with
2009-05-25 11:59:47 +02:00
\fB \- d\fR
and
2009-09-16 14:03:18 +02:00
\fB \- e\fR \& . Use
2009-05-25 11:59:47 +02:00
\fB \- v\fR
multiple times (\fB \- vv\fR ,
2009-09-16 14:03:18 +02:00
\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
2009-05-25 11:59:47 +02:00
\fB \- \- version\fR ,
\fB \- V\fR
.sp
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- wait\fR ,
\fB \- w\fR
.sp
2009-09-16 14:03:18 +02:00
Instead of terminating with an error if the table is locked, wait until the table is unlocked before continuing\& . If you are running
2009-05-25 11:59:47 +02:00
\fB mysqld\fR
with external locking disabled, the table can be locked only by another
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
command\& .
2009-05-25 11:59:47 +02:00
.RE
2015-09-09 14:32:52 +02:00
.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
2009-05-25 11:59:47 +02:00
.PP
You can also set the following variables by using
\fB \- \- \fR \fB \fI var_name\fR \fR \fB =\fR \fB \fI value\fR \fR
syntax:
2009-09-16 14:03:18 +02:00
. \" 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
2015-09-09 14:32:52 +02:00
. \" key_cache_block_size myisamchk variable
2009-09-16 14:03:18 +02:00
. \" 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
2009-05-25 11:59:47 +02:00
.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{
\fB Variable\fR
T}:T{
\fB Default 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{
2015-09-09 14:32:52 +02:00
key_cache_block_size
T}:T{
1024
T}
T{
2009-05-25 11:59:47 +02:00
myisam_block_size
T}:T{
1024
T}
T{
read_buffer_size
T}:T{
262136
T}
T{
sort_buffer_size
T}:T{
2097144
T}
2009-09-16 14:03:18 +02:00
T{
sort_key_blocks
T}:T{
16
T}
T{
stats_method
T}:T{
nulls_unequal
T}
T{
write_buffer_size
T}:T{
262136
T}
2009-05-25 11:59:47 +02:00
.TE
2009-09-16 14:03:18 +02:00
.sp 1
2009-05-25 11:59:47 +02:00
.PP
The possible
\fB myisamchk\fR
variables and their default values can be examined with
\fB myisamchk \- \- help\fR :
.PP
sort_buffer_size
is used when the keys are repaired by sorting keys, which is the normal case when you use
2009-09-16 14:03:18 +02:00
\fB \- \- recover\fR \& .
2009-05-25 11:59:47 +02:00
.PP
key_buffer_size
is used when you are checking the table with
\fB \- \- extend\- check\fR
2009-09-16 14:03:18 +02:00
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
. \}
2009-05-25 11:59:47 +02:00
You use
2009-09-16 14:03:18 +02:00
\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
2009-05-25 11:59:47 +02:00
CHAR,
VARCHAR, or
TEXT
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
to repair by sorting, you can use the
\fB \- \- sort\- recover\fR
2009-09-16 14:03:18 +02:00
option\& .
2009-05-25 11:59:47 +02:00
.RE
.PP
2009-09-16 14:03:18 +02:00
Repairing through the key buffer takes much less disk space than using sorting, but is also much slower\& .
2009-05-25 11:59:47 +02:00
.PP
If you want a faster repair, set the
key_buffer_size
and
sort_buffer_size
2009-09-16 14:03:18 +02:00
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\& .
2009-05-25 11:59:47 +02:00
.PP
myisam_block_size
2009-09-16 14:03:18 +02:00
is the size used for index blocks\& .
2009-05-25 11:59:47 +02:00
.PP
stats_method
influences how
NULL
values are treated for index statistics collection when the
\fB \- \- analyze\fR
2009-09-16 14:03:18 +02:00
option is given\& . It acts like the
2009-05-25 11:59:47 +02:00
myisam_stats_method
2009-09-16 14:03:18 +02:00
system variable\& . For more information, see the description of
2009-05-25 11:59:47 +02:00
myisam_stats_method
in
2009-09-16 14:03:18 +02:00
Section\ \& 5.1.4, \(lq Server System Variables\(rq , and
2010-04-28 15:06:11 +02:00
Section\ \& 7.4.7, \(lq MyISAM Index Statistics Collection\(rq \& .
2009-05-25 11:59:47 +02:00
.PP
ft_min_word_len
and
ft_max_word_len
indicate the minimum and maximum word length for
FULLTEXT
2009-09-16 14:03:18 +02:00
indexes\& .
2009-05-25 11:59:47 +02:00
ft_stopword_file
2009-09-16 14:03:18 +02:00
names the stopword file\& . These need to be set under the following circumstances\& .
2009-05-25 11:59:47 +02:00
.PP
If you use
\fB myisamchk\fR
to perform an operation that modifies table indexes (such as repair or analyze), the
FULLTEXT
2009-09-16 14:03:18 +02:00
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\& .
2009-05-25 11:59:47 +02:00
.PP
2009-09-16 14:03:18 +02:00
The problem occurs because these parameters are known only by the server\& . They are not stored in
2009-05-25 11:59:47 +02:00
MyISAM
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
ft_min_word_len,
ft_max_word_len, and
ft_stopword_file
values to
\fB myisamchk\fR
that you use for
2009-09-16 14:03:18 +02:00
\fB mysqld\fR \& . For example, if you have set the minimum word length to 3, you can repair a table with
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
like this:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
shell> \fB myisamchk \- \- recover \- \- ft_min_word_len=3 \fR \fB \fI tbl_name\fR \fR \fB \& .MYI\fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
To ensure that
\fB myisamchk\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
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
[mysqld]
ft_min_word_len=3
[myisamchk]
ft_min_word_len=3
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
An alternative to using
\fB myisamchk\fR
is to use the
REPAIR TABLE,
ANALYZE TABLE,
OPTIMIZE TABLE, or
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
.PP
\fB myisamchk\fR
supports the following options for table checking operations:
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" myisamchk: check option
. \" check option: myisamchk
2009-05-25 11:59:47 +02:00
\fB \- \- check\fR ,
\fB \- c\fR
.sp
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- check\- only\- changed\fR ,
\fB \- C\fR
.sp
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- extend\- check\fR ,
\fB \- e\fR
.sp
2009-09-16 14:03:18 +02:00
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,
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
or
\fB myisamchk \- \- medium\- check\fR
2009-09-16 14:03:18 +02:00
should be able to determine whether there are any errors in the table\& .
2009-05-25 11:59:47 +02:00
.sp
If you are using
\fB \- \- extend\- check\fR
and have plenty of memory, setting the
key_buffer_size
2009-09-16 14:03:18 +02:00
variable to a large value helps the repair operation run faster\& .
2009-12-01 08:24:05 +01:00
.sp
For a description of the output format, see
the section called \(lq MYISAMCHK TABLE INFORMATION\(rq \& .
2009-09-16 14:03:18 +02:00
.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
2009-05-25 11:59:47 +02:00
\fB \- \- fast\fR ,
\fB \- F\fR
.sp
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- force\fR ,
\fB \- f\fR
.sp
Do a repair operation automatically if
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
finds any errors in the table\& . The repair type is the same as that specified with the
2009-05-25 11:59:47 +02:00
\fB \- \- recover\fR
or
\fB \- r\fR
2015-09-09 14:32:52 +02:00
option\& . States will be updated as with
\fB \- \- update\- state\fR \& .
2009-09-16 14:03:18 +02:00
.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
2009-05-25 11:59:47 +02:00
\fB \- \- information\fR ,
\fB \- i\fR
.sp
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- medium\- check\fR ,
\fB \- m\fR
.sp
Do a check that is faster than an
\fB \- \- extend\- check\fR
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- read\- only\fR ,
\fB \- T\fR
.sp
2009-09-16 14:03:18 +02:00
Do not mark the table as checked\& . This is useful if you use
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
to check a table that is in use by some other application that does not use locking, such as
\fB mysqld\fR
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- update\- state\fR ,
\fB \- U\fR
.sp
Store information in the
2009-09-16 14:03:18 +02:00
\& .MYI
file to indicate when the table was checked and whether the table crashed\& . This should be used to get full benefit of the
2009-05-25 11:59:47 +02:00
\fB \- \- check\- only\- changed\fR
2009-09-16 14:03:18 +02:00
option, but you shouldn\' t use this option if the
2009-05-25 11:59:47 +02:00
\fB mysqld\fR
2009-09-16 14:03:18 +02:00
server is using the table and you are running it with external locking disabled\& .
.RE
.SH "MYISAMCHK REPAIR OPTIONS"
. \" repair options: myisamchk
. \" files: repairing
2009-05-25 11:59:47 +02:00
.PP
\fB myisamchk\fR
2009-12-01 08:24:05 +01:00
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):
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" myisamchk: backup option
. \" backup option: myisamchk
2009-05-25 11:59:47 +02:00
\fB \- \- backup\fR ,
\fB \- B\fR
.sp
Make a backup of the
2009-09-16 14:03:18 +02:00
\& .MYD
2009-05-25 11:59:47 +02:00
file as
2009-09-16 14:03:18 +02:00
\fI file_name\fR \- \fI time\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
2009-05-25 11:59:47 +02:00
\fB \- \- character\- sets\- dir=\fR \fB \fI path\fR \fR
.sp
2015-09-09 14:32:52 +02:00
The directory where character sets are installed\& .
2009-09-16 14:03:18 +02:00
.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
2009-05-25 11:59:47 +02:00
\fB \- \- correct\- checksum\fR
.sp
2009-09-16 14:03:18 +02:00
Correct the checksum information for the table\& .
2015-09-09 14:32:52 +02:00
.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 \& .
2009-09-16 14:03:18 +02:00
.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
2009-12-01 08:24:05 +01:00
\fB \- \- data\- file\- length=\fR \fB \fI len\fR \fR ,
\fB \- D \fR \fB \fI len\fR \fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
The maximum length of the data file (when re\- creating data file when it is
\(lq full\(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
2009-05-25 11:59:47 +02:00
\fB \- \- extend\- check\fR ,
\fB \- e\fR
.sp
2009-09-16 14:03:18 +02:00
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\& .
2009-12-01 08:24:05 +01:00
.sp
For a description of the output format, see
the section called \(lq MYISAMCHK TABLE INFORMATION\(rq \& .
2009-09-16 14:03:18 +02:00
.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
2009-05-25 11:59:47 +02:00
\fB \- \- force\fR ,
\fB \- f\fR
.sp
Overwrite old intermediate files (files with names like
2015-09-09 14:32:52 +02:00
\fI tbl_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
\fB myisam_sort_buffer_size\fR
and dynamically allocate as many management buffers as needed\& .
2009-09-16 14:03:18 +02:00
.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
2009-05-25 11:59:47 +02:00
\fB \- \- keys\- used=\fR \fB \fI val\fR \fR ,
\fB \- k \fR \fB \fI val\fR \fR
.sp
For
2009-09-16 14:03:18 +02:00
\fB myisamchk\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
\fB myisamchk \- 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
2009-05-25 11:59:47 +02:00
\fB \- \- max\- record\- length=\fR \fB \fI len\fR \fR
.sp
Skip rows larger than the given length if
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- parallel\- recover\fR ,
\fB \- p\fR
.sp
2009-09-16 14:03:18 +02:00
Use the same technique as
2009-05-25 11:59:47 +02:00
\fB \- r\fR
and
2009-09-16 14:03:18 +02:00
\fB \- n\fR , but create all the keys in parallel, using different threads\& .
\fI This 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
2009-05-25 11:59:47 +02:00
\fB \- \- quick\fR ,
\fB \- q\fR
.sp
2010-04-28 15:06:11 +02:00
Achieve a faster repair by modifying only the index file, not the data file\& . You can specify this option twice to force
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
2015-09-09 14:32:52 +02:00
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\& .
2009-09-16 14:03:18 +02:00
.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
2009-05-25 11:59:47 +02:00
\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
2009-09-16 14:03:18 +02:00
tables)\& . If you want to recover a table, this is the option to try first\& . You should try
2009-05-25 11:59:47 +02:00
\fB \- \- safe\- recover\fR
only if
\fB myisamchk\fR
reports that the table cannot be recovered using
2009-09-16 14:03:18 +02:00
\fB \- \- recover\fR \& . (In the unlikely case that
2009-05-25 11:59:47 +02:00
\fB \- \- recover\fR
2009-09-16 14:03:18 +02:00
fails, the data file remains intact\& .)
2009-05-25 11:59:47 +02:00
.sp
If you have lots of memory, you should increase the value of
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- safe\- recover\fR ,
\fB \- o\fR
.sp
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- recover\fR , but can handle a couple of very unlikely cases that
\fB \- \- recover\fR
2009-09-16 14:03:18 +02:00
cannot\& . This recovery method also uses much less disk space than
\fB \- \- recover\fR \& . Normally, you should repair first using
2009-05-25 11:59:47 +02:00
\fB \- \- recover\fR , and then with
\fB \- \- safe\- recover\fR
only if
\fB \- \- recover\fR
2009-09-16 14:03:18 +02:00
fails\& .
2009-05-25 11:59:47 +02:00
.sp
If you have lots of memory, you should increase the value of
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- set\- collation=\fR \fB \fI name\fR \fR
.sp
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- sort\- recover\fR ,
\fB \- n\fR
.sp
Force
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- tmpdir=\fR \fB \fI path\fR \fR ,
\fB \- t \fR \fB \fI path\fR \fR
.sp
2009-09-16 14:03:18 +02:00
The path of the directory to be used for storing temporary files\& . If this is not set,
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
uses the value of the
TMPDIR
2009-09-16 14:03:18 +02:00
environment variable\& .
2009-05-25 11:59:47 +02:00
tmpdir
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- unpack\fR ,
\fB \- u\fR
.sp
Unpack a table that was packed with
2009-09-16 14:03:18 +02:00
\fB myisampack\fR \& .
.RE
2009-05-25 11:59:47 +02:00
.SH "OTHER MYISAMCHK OPTIONS"
.PP
\fB myisamchk\fR
supports the following options for actions other than table checks and repairs:
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" myisamchk: analyze option
. \" analyze option: myisamchk
2009-05-25 11:59:47 +02:00
\fB \- \- analyze\fR ,
\fB \- a\fR
.sp
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB myisamchk \- \- description \- \- verbose \fR \fB \fI tbl_name\fR \fR
command or the
SHOW INDEX FROM \fI tbl_name\fR
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- block\- search=\fR \fB \fI offset\fR \fR ,
\fB \- b \fR \fB \fI offset\fR \fR
.sp
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- description\fR ,
\fB \- d\fR
.sp
2009-12-01 08:24:05 +01:00
Print some descriptive information about the table\& . Specifying the
\fB \- \- verbose\fR
option once or twice produces additional information\& . See
the section called \(lq MYISAMCHK TABLE INFORMATION\(rq \& .
2009-09-16 14:03:18 +02:00
.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
2009-05-25 11:59:47 +02:00
\fB \- \- set\- auto\- increment[=\fR \fB \fI value\fR \fR \fB ]\fR ,
\fB \- A[\fR \fB \fI value\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
2009-09-16 14:03:18 +02:00
values this large)\& . If
2009-05-25 11:59:47 +02:00
\fI value\fR
is not specified,
AUTO_INCREMENT
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- sort\- index\fR ,
\fB \- S\fR
.sp
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- sort\- records=\fR \fB \fI N\fR \fR ,
\fB \- R \fR \fB \fI N\fR \fR
.sp
2009-09-16 14:03:18 +02:00
Sort records according to a particular index\& . This makes your data much more localized and may speed up range\- based
2009-05-25 11:59:47 +02:00
SELECT
and
ORDER BY
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
sees them\& . Indexes are numbered beginning with 1\& .
2009-05-25 11:59:47 +02:00
.sp
If keys are not packed (PACK_KEYS=0), they have the same length, so when
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
sorts and moves records, it just overwrites record offsets in the index\& . If keys are packed (PACK_KEYS=1),
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
2009-09-16 14:03:18 +02:00
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
2015-09-09 14:32:52 +02:00
.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
2009-12-01 08:24:05 +01:00
.SH "MYISAMCHK TABLE INFORMATION"
. \" table description: myisamchk
. \" tables: information
. \" examples: myisamchk output
. \" myisamchk: example output
2009-05-25 11:59:47 +02:00
.PP
2009-12-01 08:24:05 +01:00
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
. \}
\fB myisamchk \- d \fR \fB \fI tbl_name\fR \fR
.sp
Runs
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
2009-12-01 08:24:05 +01:00
in
\(lq describe mode\(rq
2015-09-09 14:32:52 +02:00
to produce a description of your table\& . If you start the MariaDB server with external locking disabled,
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
2009-12-01 08:24:05 +01:00
may report an error for a table that is updated while it runs\& . However, because
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
2009-12-01 08:24:05 +01:00
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
. \}
\fB myisamchk \- dv \fR \fB \fI tbl_name\fR \fR
.sp
Adding
\fB \- v\fR
runs
\fB myisamchk\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
. \}
\fB myisamchk \- eis \fR \fB \fI tbl_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
. \}
\fB myisamchk \- eiv \fR \fB \fI tbl_name\fR \fR
.sp
This is like
\fB \- eis\fR , but tells you what is being done\& .
.RE
.PP
The
\fI tbl_name\fR
argument can be either the name of a
MyISAM
table or the name of its index file, as described in
\fB myisamchk\fR (1)\& . Multiple
\fI tbl_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
\fB myisamchk\fR
shown later, some values are smaller and fit the output format more easily\& .)
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-12-01 08:24:05 +01:00
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;
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
2009-12-01 08:24:05 +01:00
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
. \}
2009-05-25 11:59:47 +02:00
.PP
2009-12-01 08:24:05 +01:00
Example of
\fB myisamchk \- 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
. \}
2009-05-25 11:59:47 +02:00
.PP
2009-12-01 08:24:05 +01:00
Explanations for the types of information
2009-05-25 11:59:47 +02:00
\fB myisamchk\fR
2009-12-01 08:24:05 +01:00
produces are given here\& .
\(lq Keyfile\(rq
refers to the index file\& .
\(lq Record\(rq
and
\(lq row\(rq
are synonymous, as are
\(lq field\(rq
and
\(lq column\& .\(rq
.PP
The initial part of the table description contains these values:
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-12-01 08:24:05 +01:00
MyISAM file
.sp
Name of the
MyISAM
(index) file\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-12-01 08:24:05 +01:00
Record format
.sp
The format used to store table rows\& . The preceding examples use
Fixed length\& . Other possible values are
Compressed
and
2010-04-28 15:06:11 +02:00
Packed\& . (Packed
corresponds to what
SHOW TABLE STATUS
reports as
Dynamic\& .)
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-12-01 08:24:05 +01:00
Chararacter set
.sp
The table default character set\& .
.RE
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.RS 4
2009-12-01 08:24:05 +01:00
.ie n \{ \
\h '-04'\(bu \h '+03'\c
2009-09-16 14:03:18 +02:00
. \}
2009-12-01 08:24:05 +01:00
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
File\- version
.sp
Version of
MyISAM
format\& . Currently always 1\& .
2009-05-25 11:59:47 +02:00
.RE
2009-12-01 08:24:05 +01:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
2009-09-16 14:03:18 +02:00
. \}
2009-12-01 08:24:05 +01:00
Creation time
2009-09-16 14:03:18 +02:00
.sp
2009-12-01 08:24:05 +01:00
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
2010-04-28 15:06:11 +02:00
Section\ \& 6.6.4, \(lq MyISAM Table Optimization\(rq \& .
2009-12-01 08:24:05 +01:00
.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
2010-04-28 15:06:11 +02:00
Section\ \& 6.6.4, \(lq MyISAM Table Optimization\(rq \& .
2009-12-01 08:24:05 +01:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
Datafile pointer
.sp
2015-09-09 14:32:52 +02:00
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\& .
2009-12-01 08:24:05 +01:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
Keyfile pointer
.sp
2015-09-09 14:32:52 +02:00
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\& .
2009-12-01 08:24:05 +01:00
.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,
\fB myisamchk\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
2015-09-09 14:32:52 +02:00
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\& .
2009-12-01 08:24:05 +01:00
.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
\fB myisamchk \- 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(\fI N\fR )
.sp
The most significant
\fI N\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
\fB myisampack\fR \& . See
\fB myisampack\fR (1), for an example of this information\& .
.PP
Example of
\fB myisamchk \- 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
\fB myisamchk \- 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
2010-04-28 15:06:11 +02:00
Section\ \& 6.6.4, \(lq MyISAM Table Optimization\(rq \& .
2009-12-01 08:24:05 +01:00
.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
\fB myisamchk\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
2015-09-09 14:32:52 +02:00
MariaDB tries to pack key values that have a common suffix\& . This can only be used for indexes on
2009-12-01 08:24:05 +01:00
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
2015-09-09 14:32:52 +02:00
MariaDB strips spaces from the end of strings\& . The
2009-12-01 08:24:05 +01:00
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
2010-04-28 15:06:11 +02:00
Section\ \& 6.6.4, \(lq MyISAM Table Optimization\(rq \& .
2009-12-01 08:24:05 +01:00
.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
\fB myisamchk\fR \& .
\fB myisamchk\fR
uses no more memory than its memory\- related variables are set to\& . If you are going to use
\fB myisamchk\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
\fB myisamchk\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> \fB myisamchk \- \- 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
\fB myisamchk\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
\fB myisamchk\fR
with the
\fB \- \- tmpdir=\fR \fB \fI path\fR \fR
option to specify a directory located on a file system that has more space\& .
.PP
When performing repair operations,
\fB myisamchk\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\& .
\fI This 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 \fI path\fR \fR )\& . The following formula yields the amount of space required:
.sp
.if n \{ \
.RS 4
. \}
.nf
(\fI largest_key\fR + \fI row_pointer_length\fR ) \(mu \fI number_of_rows\fR \(mu 2
.fi
.if n \{ \
.RE
. \}
.sp
You can check the length of the keys and the
\fI row_pointer_length\fR
with
\fB myisamchk \- dv \fR \fB \fI tbl_name\fR \fR
(see
the section called \(lq MYISAMCHK TABLE INFORMATION\(rq )\& . The
\fI row_pointer_length\fR
and
\fI number_of_rows\fR
values are the
Datafile pointer
and
Data records
values in the table description\& . To determine the
\fI largest_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\& .
2009-05-25 11:59:47 +02:00
.RE
.PP
If you have a problem with disk space during repair, you can try
\fB \- \- safe\- recover\fR
instead of
2009-09-16 14:03:18 +02:00
\fB \- \- recover\fR \& .
2009-05-25 11:59:47 +02:00
.SH "COPYRIGHT"
2009-09-16 14:03:18 +02:00
.br
2009-05-25 11:59:47 +02:00
.PP
2020-05-15 17:35:47 +02:00
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation
2009-05-25 11:59:47 +02:00
.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
2019-05-11 21:29:06 +03:00
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/.
2009-09-16 14:03:18 +02:00
.sp
2009-05-25 11:59:47 +02:00
.SH "SEE ALSO"
2015-09-09 14:32:52 +02:00
For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
2009-05-25 11:59:47 +02:00
.SH AUTHOR
2015-09-09 14:32:52 +02:00
MariaDB Foundation (http://www.mariadb.org/).