This article mainly introduces the table_cache configuration parameters of MySQLPerformance Optimization. This article introduces its cache mechanism, parameter optimization and clearing For cached commands, friends in need can refer to
table_cache is a very important MySQL performance parameter. It is called table_open_cache in versions after 5.1.3. table_cache is mainly used to set the number of table caches. Since each client connection accesses at least one table, the value of this parameter is related to max_connections.
Caching mechanism
When a connection accesses a table, MySQL will check the number of currently cached tables. If the table has been opened in the cache, the table in the cache will be directly accessed to speed up query; if the table has not been cached, the current table will be added to the cache and queried.
Before performing a cache operation, table_cache is used to limit the maximum number of cached tables: if the currently cached table does not reach table_cache, a new table will be added; if this value has been reached, MySQL will cache it based on The last query time, query rate and other rules of the table release the previous cache.
Parameter tuning
Generally speaking, you can view the values of Open_tables and Opened_tables in phpmyadmin, or you can execute
mysql> show global status like 'open%_tables';
to view the current open_tables The situation is as shown in the figure:
# to view the values of these two parameters. Among them, Open_tables is the number of tables currently being opened, and Opened_tables is the number of all open tables.
If the value of Open_tables is close to the value of table_cache, and Opened_tables continues to grow, it means that mysql is releasing the cached table to accommodate the new table. At this time, the value of table_cache may need to be increased. For most situations,
is a more suitable value:
Open_tables / Opened_tables >= 0.85 Open_tables / table_cache <= 0.95
If you are not very sure about this parameter, VPS Management Encyclopedia gives a very conservative setting suggestion: MySQL databasePut it in the production environment for a trial run for a period of time, and then adjust the parameter value to be larger than the value of Opened_tables, and ensure that it is still slightly larger than Opened_tables under extreme conditions with relatively high load.
Clear cache
Executing the
mysql > flush tables;
command will clear all currently cached tables.
The above is the detailed content of Description of table_cache configuration parameters in mysql. For more information, please follow other related articles on the PHP Chinese website!

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于架构原理的相关内容,MySQL Server架构自顶向下大致可以分网络连接层、服务层、存储引擎层和系统文件层,下面一起来看一下,希望对大家有帮助。

mysql的msi与zip版本的区别:1、zip包含的安装程序是一种主动安装,而msi包含的是被installer所用的安装文件以提交请求的方式安装;2、zip是一种数据压缩和文档存储的文件格式,msi是微软格式的安装包。

方法:1、利用right函数,语法为“update 表名 set 指定字段 = right(指定字段, length(指定字段)-1)...”;2、利用substring函数,语法为“select substring(指定字段,2)..”。

在mysql中,可以利用char()和REPLACE()函数来替换换行符;REPLACE()函数可以用新字符串替换列中的换行符,而换行符可使用“char(13)”来表示,语法为“replace(字段名,char(13),'新字符串') ”。

转换方法:1、利用cast函数,语法“select * from 表名 order by cast(字段名 as SIGNED)”;2、利用“select * from 表名 order by CONVERT(字段名,SIGNED)”语句。

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于MySQL复制技术的相关问题,包括了异步复制、半同步复制等等内容,下面一起来看一下,希望对大家有帮助。

在mysql中,可以利用REGEXP运算符判断数据是否是数字类型,语法为“String REGEXP '[^0-9.]'”;该运算符是正则表达式的缩写,若数据字符中含有数字时,返回的结果是true,反之返回的结果是false。

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了mysql高级篇的一些问题,包括了索引是什么、索引底层实现等等问题,下面一起来看一下,希望对大家有帮助。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.