Oracle 5.0 Reference Manual page 708

Table of Contents

Advertisement

• For
TABLE, the same principle applies, but because the repair is done by the server,
REPAIR
you set server system variables instead of
memory-allocation variables, increasing the
increases the likelihood that the repair will use the faster filesort method and avoid the slower repair
by key cache method. Set the variable to the maximum file size for your system, after checking to
be sure that there is enough free space to hold a copy of the table files. The free space must be
available in the file system containing the original table files.
Suppose that a
myisamchk
memory-allocation variables:
--key_buffer_size=128M --sort_buffer_size=256M
--read_buffer_size=64M --write_buffer_size=64M
Some of those
myisamchk
Variable
myisamchk
key_buffer_size
sort_buffer_size
read_buffer_size
write_buffer_size
Each of the server system variables can be set at runtime, and some of them
(myisam_sort_buffer_size
to a global value. Setting a session value limits the effect of the change to your current session
and does not affect other users. Changing a global-only variable
myisam_max_sort_file_size
you must take into account that the buffer is shared with those users. For example, if you set
the
myisamchk key_buffer_size
[458]
key_buffer_size
key buffer use by activity in other sessions. However, changing the global key buffer size invalidates
the buffer, causing increased disk I/O and slowdown for other sessions. An alternative that avoids this
problem is to use a separate key cache, assign to it the indexes from the table to be repaired, and
deallocate it when the repair is complete. See
Based on the preceding remarks, a
similar to the
myisamchk
system is assumed to permit a file size of at least 100GB.
SET SESSION myisam_sort_buffer_size = 256*1024*1024;
SET SESSION read_buffer_size = 64*1024*1024;
SET GLOBAL myisam_max_sort_file_size = 100*1024*1024*1024;
SET GLOBAL repair_cache.key_buffer_size = 128*1024*1024;
CACHE INDEX
tbl_name
LOAD INDEX INTO CACHE tbl_name;
REPAIR TABLE
tbl_name
SET GLOBAL repair_cache.key_buffer_size = 0;
If you intend to change a global variable but want to do so only for the duration of a
operation to minimally affect other users, save its value in a user variable and restore it afterward. For
example:
SET @old_myisam_sort_buffer_size = @@global.myisam_max_sort_file_size;
SET GLOBAL myisam_max_sort_file_size = 100*1024*1024*1024;
REPAIR TABLE tbl_name ;
SET GLOBAL myisam_max_sort_file_size = @old_myisam_max_sort_file_size;
The system variables that affect
values to be in effect by default. For example, add these lines to the server
[mysqld]
myisam_sort_buffer_size=256M
Optimizing
Non-SELECT
myisamchk
table-repair operation is done using the following options to set its
variables correspond to server system variables:
[476],
read_buffer_size
[474]) affects other users as well. For
variable to 128MB, you could set the corresponding
system variable larger than that (if it is not already set larger), to allow for
REPAIR TABLE
command. Here a separate 128MB key buffer is allocated and the file
IN repair_cache;
;
REPAIR TABLE
688
Statements
variables. Also, In addition to setting
myisam_max_sort_file_size
System Variable
key_buffer_size
myisam_sort_buffer_size
read_buffer_size
none
[488]) have a session value in addition
(key_buffer_size
Section 8.6.1.2, "Multiple Key
operation can be done as follows to use settings
can be set globally at server startup if you want the
[474]
system variable
[458]
[476]
[488]
[458],
[458],
key_buffer_size
Caches".
REPAIR TABLE
file:
my.cnf

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents