How To Avoid Repair With Keycache?

前端 未结 6 1239
南笙
南笙 2020-12-12 20:58

I have had some experience with optimizing the my.cnf file but my database has around 4 million records (MyISAM). I am trying to restore from a mysqldump but every time I d

6条回答
  •  温柔的废话
    2020-12-12 21:25

    "Repair by sorting" uses the filesort routine, which in turn creates several temporary files (usually) in your tmpdir.

    If your tmpdir does not have enough space for them, it will revert to "Repair by keycache". This is extremely bad as it's much slower AND creates less optimal indexes.

    There are some other conditions but I haven't identified them.

    Working out the size of tmpdir you need for filesort() is nontrivial; the format data are stored in the filesort buffer is not the same as MYD files, it typically uses a lot more space.

    So if your tmpdir points at a small /tmp (or tmpfs), you might want to change it to a larger /var/tmp - if that exists.

提交回复
热议问题