I am running a website game. I haven't touched anything such as reseting query cache for the year that the game has been up, I'm working with about 5000-1million rows depending on the table. Everything is being updated constantly and things being inserted into the tables. If I understand correctly, every insert or update will clear the cache for that table? That's what my searching online has found, I don't know if that's true though or if I should be regularly reseting the cache.
Queries that happened a month ago are probably no longer useful now. So if it's storing those query results then it's completely worthless because chances are no one is going to run that same exact query again.
I ran SHOW STATUS LIKE "Qcache%" and the results were:
Qcache_free_blocks 6941
Qcache_free_memory 23490288
Qcache_hits 253269763
Qcache_inserts 368937684
Qcache_lowmem_prunes 57410566
Qcache_not_cached 9872266
Qcache_queries_in_cache 35275
Qcache_total_blocks 84877
I don't really kno开发者_运维问答w what those things mean or if they are even useful in determining whether or not I need to reset the cache. Thanks in advance.
The manual didn't lie to you, any queries which alter data in a table invalidate any cache entries that reference that table. You never have to manually flush the cache.
If your data is updated so often that queries would never last in the cache, or the same query is run so infrequently that it's not useful to cache it, then you're just wasting huge amounts of memory and CPU time checking and invalidating cache entries on every INSERT
and UPDATE
query. You could actually see a performance increase by turning off the query cache.
精彩评论