mabots' blog

知のレバレッジを最大化せよ (旧はてなダイアリーから移転しました。)

Macbook Air にいれた開発用 MySQL 5.6.xx の メモリ使用量が異様に多い

homebrew で Macbook Air ( Mac OS X 10.8 ) mysql をいれると、最近の 5.6以降がはいりますが、アクティビティモニタでみると、コンスタントに462MB ほど消費してしまっています。メモリが貴重な MBA では激重です・・。

今回の MySQL バージョン的には

$ mysql -V
mysql  Ver 14.14 Distrib 5.6.13, for osx10.8 (x86_64) using  EditLine wrapper

原因

対策

  • my.cnf を設置 して table_definition_cache を最小値にします
    • /usr/local/etc/my.cnf 等に設置する
そもそもどういうもの?
# The number of table definitions (from .frm files) that can be stored in the definition cache.
# If you use a large number of tables, you can create a large table definition cache to speed up opening of tables.
# The table definition cache takes less space and does not use file descriptors, unlike the normal table cache.
# The minimum and default values are both 400.
table_definition_cache=1400
今回は最小値として 400 をセット
table_definition_cache=400

結果

  • 71MB 程度に減りました。すっきりです。