By appropriately adjusting table_cache, mysql can work faster in our consciousness. we usually increase table_cache and try to keep opened table handles in the cache. mysql can respond to operations more quickly, however, when I increase the size of table_cache, the cpu increases a lot. I found that the bigger the size of table_cache is, the better, because mysql only has one global lock to control the opening and closing of tables, that is to say, no matter how many threads are executing in parallel, there is only one thread that can open or close the table, which will lead to many deadlocks. other threads are waiting for that global lock, the cpu consumption is increased correspondingly, the SQL execution time of other linked threads is extended, and the system performance is reduced. Therefore, when table_cache is sufficient, try to keep table_cache small enough, but I still have to learn how to grasp this degree.
References:
About table_cache
Side effects of table_cache
We are running fast