How to Diagnose and Optimize MySQL Table Cache Using Open Tables Metrics
This guide explains the meaning of MySQL's Open_tables and Opened_tables status variables, shows how to check them, and provides recommended ratios and steps to adjust the table_cache setting for better database performance.
In MySQL, Open_tables shows the number of tables currently opened, while Opened_tables counts the total tables opened since the server started.
You can view these values with:
show global status like 'open%tables%';If Opened_tables is high, the table_cache setting may be too low. Check the current cache size:
show variables like 'table_cache';Typical healthy ratios are:
Open_tables / Opened_tables × 100 ≥ 85 %
Open_tables / table_cache × 100 ≤ 95 %
Adjust the cache size accordingly, for example: SET GLOBAL table_cache=600; After changing the value, monitor the ratios again to ensure optimal performance.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
