Open_tables Opened_tables table_open_cache
来源:互联网 发布:mac怎么修改用户名 编辑:程序博客网 时间:2024/06/05 17:50
今天开发说应用链接数据库比较慢,定位后发现是table_open_cache太小了引起的问题。
如果你发现Opened_tables比较大并且一直再增大,很可能是table_open_cache设置太小了,导致每次链接数据库都要去打开表,这也会造成链接数据库比较慢。
Open_tables : The number of tables that are open.Opened_tables : The number of tables that have been opened. If Opened_tables is big, your table_open_cache value is probably too small.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. If the value of Opened_tables is large and you do not use FLUSH TABLES often (which just forces all tables to be closed and reopened), then you should increase the value of the table_open_cache variable. For more information about the table cache,测试:
mysql> show variables like 'table_open_cache';+------------------+-------+| Variable_name | Value |+------------------+-------+| table_open_cache | 4 |+------------------+-------+1 row in set (0.00 sec)mysql> show global status like 'open%tables%'; +---------------+----------+| Variable_name | Value |+---------------+----------+| Open_tables | 4 || Opened_tables | 11412131 |+---------------+----------+2 rows in set (0.00 sec)mysql> exit[root@slave159 bin]# mysql -uroot -h192.168.60.204 -p1234 pva1-- 说明:3s左右才登陆mysql> show global status like 'open%tables%'; +---------------+----------+| Variable_name | Value |+---------------+----------+| Open_tables | 4 || Opened_tables | 11413673 |+---------------+----------+2 rows in set (0.01 sec)mysql> select 11413673-11412131;+-------------------+| 11413673-11412131 |+-------------------+| 1542 |+-------------------+1 row in set (0.00 sec)mysql> set global table_open_cache=2000;Query OK, 0 rows affected (0.00 sec)mysql> exitBye[root@slave159 bin]# mysql -uroot -h192.168.60.204 -p1234 pva1-- 说明:3s左右才登陆mysql> show global status like 'open%tables%'; +---------------+----------+| Variable_name | Value |+---------------+----------+| Open_tables | 574 || Opened_tables | 11433986 |+---------------+----------+mysql> exitBye[root@slave159 bin]# mysql -uroot -h192.168.60.204 -p1234 pva1-- 说明:1s内就登陆了mysql> show global status like 'open%tables%'; +---------------+----------+| Variable_name | Value |+---------------+----------+| Open_tables | 574 || Opened_tables | 11433986 |+---------------+----------+
0 0
- table_open_cache Open_tables Opened_tables
- Open_tables Opened_tables table_open_cache
- table_open_cache
- table_open_cache太大引发的问题
- MySQL的table_cache/table_open_cache参数
- MYSQL实践心得:table_open_cache…
- table_open_cache参数对mysql性能的影响
- table_open_cache参数对mysql性能的影响
- MYSQL实践心得:table_open_cache的设置
- MYSQL实践心得:table_open_cache的设置
- Android最佳性能实践(二)——分析内存的使用情况
- 关于C#中Thread.Join()的一点理解
- java实例化对象的过程
- 窗口開啟居中
- 日期获取方式
- Open_tables Opened_tables table_open_cache
- IONIC 环境搭建
- [leetcode] 64. Minimum Path Sum
- 如何修改VirtualBox虚拟机VDI文件的UUID
- Spring和shiro都用到的Ant 匹配原则!
- Android最佳性能实践(三)——高性能编码优化
- 利用mahout的Bayes算法的文本情感分析
- Android:Activity——生命周期深入详解
- 4418: [Shoi2013]扇形面积并|二分答案|树状数组