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. 运行myisamchk时,内存分配很重要。myisamchk使用的内存不超过其内存相关变量的设置值。If you are going to use myisamchk on very large tables, you should first decide how much memory you want it to use. 如果你要在非常大的表上使用myisamchk,你应该首先决定你想要它使用多少内存。The default is to use only about 3MB to perform repairs. 默认情况下,仅使用约3MB进行维修。By using larger values, you can get myisamchk to operate faster. 通过使用更大的值,你可以让myisamchk运行得更快。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):例如,如果您有超过512MB的可用RAM,则可以使用以下选项(除了您可能指定的任何其他选项):

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.在大多数情况下,使用--myisam_sort_buffer_size=16M可能就足够了。

Be aware that myisamchk uses temporary files in TMPDIR. 请注意,myisamchkTMPDIR中使用临时文件。If TMPDIR points to a memory file system, out of memory errors can easily occur. 如果TMPDIR指向内存文件系统,则很容易发生内存不足错误。If this happens, run myisamchk with the --tmpdir=dir_name option to specify a directory located on a file system that has more space.如果发生这种情况,请使用--tmpdir=dir_name选项运行myisamchk,以指定位于具有更多空间的文件系统上的目录。

When performing repair operations, myisamchk also needs a lot of disk space:在执行修复操作时,myisamchk还需要大量的磁盘空间:

If you have a problem with disk space during repair, you can try --safe-recover instead of --recover.如果在修复过程中磁盘空间有问题,可以尝试使用--safe-recover而不是--recover