究竟该如何设置这个值 table_cache=?
发现当前一个配置问题 (mysql +linux 在线系统)
show global status like 'open%tables%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Open_tables | 966 |
| Opened_tables | 2919 |
+---------------+-------+
2 rows in set
根据这些天潜心研究 (下面是有关知识)
table_cache指示表高速缓存的大小。当Mysql访问一个表时,如果在Mysql表缓冲区中还有空间,那么这个表就被打开并放入表缓冲区,这样做的好处是可以更快速地访问表中的内容。一般来说,可以通过查看数据库运行峰值时间的状态值Open_tables和Opened_tables,用以判断是否需要增加table_cache的值
show global status like 'open%tables%';查看打开表的情况
Open_tables表示打开表的数量,Opened_tables表示打开过的表数量,如果Opened_tables数量过大,说明配置中table_cache(5.1.3之后这个值叫做table_open_cache)值可能太小。
比较适合的值:
Open_tables / Opened_tables * 100% >= 85%
Open_tables / table_cache * 100% <= 95%
当前我设置这个在线db的 table_cache=1024
由此引发一个问题
966/2919 仅仅为33% 这个是明显有问题的。 (这个系统是主机 有从机器从他那里取数据)
请问我究竟该如何设置这个值 table_cache=??