When evaluating whether table_open_cache needs to be adjusted, check how quickly Opened_tables increases during the workload you are investigating. A high total alone does not mean the cache is too small. Check cache misses and overflows as well, and consider whether a recent restart or table flushing caused the additional table openings.
- Start with your server’s current value. The documented default for Oracle MySQL 8.0 and 8.4 is 4000, but the right value depends on your workload.
- If frequent table openings and cache misses suggest insufficient cache capacity, check available memory and the operating system’s open-file limit before testing a higher value.
- Compare query response times, errors and resource usage under a similar workload.
- Keep the change only if it improves the original problem without causing resource pressure.
A larger cache can require more memory and file descriptors, which are handles used to access open files. If MySQL runs out of file descriptors, queries or connections can fail.
Try to
increase MySQL open_files_limit in case you can't increase table_open_cache variable.