Rechercher dans le manuel MySQL
4.6.4.6 myisamchk Memory Usage
Memory allocation is important when you run myisamchk. myisamchk uses no more memory than its memory-related variables are set to. If you are going to use myisamchk 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 myisamchk to operate faster. For example, if you have more than 512MB RAM available, you could use options such as these (in addition to any other options you might specify):
shell> myisamchk --myisam_sort_buffer_size=256M \
--key_buffer_size=512M \
--read_buffer_size=64M \
--write_buffer_size=64M ...
Using --myisam_sort_buffer_size=16M
is probably
enough for most cases.
Be aware that myisamchk uses temporary files
in TMPDIR
. If TMPDIR
points to a memory file system, out of memory errors can easily
occur. If this happens, run myisamchk with
the
--tmpdir=
option to specify a directory located on a file system that has
more space.
dir_name
When performing repair operations, myisamchk also needs a lot of disk space:
Twice the size of the data file (the original file and a copy). This space is not needed if you do a repair with
--quick
; in this case, only the index file is re-created. This space must be available on the same file system as the original data file, as the copy is created in the same directory as the original.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.
When using
--recover
or--sort-recover
(but not when using--safe-recover
), you need space on disk for sorting. This space is allocated in the temporary directory (specified byTMPDIR
or--tmpdir=
). The following formula yields the amount of space required:dir_name
(largest_key + row_pointer_length) * number_of_rows * 2
You can check the length of the keys and the
row_pointer_length
with myisamchk -dvtbl_name
(see Section 4.6.4.5, “Obtaining Table Information with myisamchk”). Therow_pointer_length
andnumber_of_rows
values are theDatafile pointer
andData records
values in the table description. To determine thelargest_key
value, check theKey
lines in the table description. TheLen
column indicates the number of bytes for each key part. For a multiple-column index, the key size is the sum of theLen
values for all key parts.
If you have a problem with disk space during repair, you can try
--safe-recover
instead of
--recover
.
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-myisamchk-memory.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.