MySQL关于Table cache设置,看这一篇就够了

本文详细解析了MySQL中的table_definition_cache、table_open_cache和table_open_cache_instances参数,包括它们的作用、限制及调整建议。了解这些参数有助于优化MySQL数据库性能,特别是并发访问时的表打开和关闭操作。建议根据实际环境和需求合理设置,并关注Open_tables、Opened_tables等状态变量进行监控和调整。
摘要由CSDN通过智能技术生成

导读:本文整理对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 descriptors, 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 descriptors that mysqld requires. You can check whether you need to increase the table cache by checking the Opened_tables status variable

所有线程打开的表的数量。增加这个值会增加mysqld需要的文件描述符的数量。可以通过检查Opened_tables状态变量来检查是否需要增加表缓存。

是不是可以理解为ibd/MYI/MYD 文件,打开数量了。但MySQL内部需要对表进行操作的时候,第一需要找到最上层文件的句柄信息,table_open_cache_instances是能提供的,之后对应的寻找ibd,MYI,MYD文件。官网对于这部分没有明确说明。

3. table_open_cache_instances

The number of open tables cache instances. To improve scalability by reducing contention among sess

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值