Databases 2 min read

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.

Java High-Performance Architecture
Java High-Performance Architecture
Java High-Performance Architecture
How to Diagnose and Optimize MySQL Table Cache Using Open Tables Metrics

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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

optimizationmysqldatabasestable cacheopen tables
Java High-Performance Architecture
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.