原标题:MySQL关于Table cache设置,看这一篇就够了
导读:本文整理对table_definition_cache,table_open_cache和table_open_cache_instances这几种参数的理解,希望对大家有帮助。
先看看官网怎么说:
1. table_definition_cache
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 deors, unlike the normal table cache.
理解下来,就是控制总frm文件的数量,还是个hash表,内部维护。如果打开的表实例的数量超过了table_definition_cache设置,LRU机制将开始标记表实例以进行清除,并最终将它们从数据字典缓存中删除。
简单通俗点frm文件有多少,就设置多少了。
2. table_open_cache
The number of open tables for all threads. Increasing this value increases the number of file deors that mysqld requires. You can check whether you need to increase the table cache by checkin