MySQL

Query Cache Thrashing (Legacy)

info
performanceUpdated Mar 2, 2026

Query cache experiencing high invalidation rate, causing more overhead than benefit. Frequent table updates invalidate cached queries, leading to cache thrashing. Note: Query cache is deprecated in MySQL 5.7.20 and removed in MySQL 8.0.

Technologies:
How to detect:

mysql.performance.qcache_lowmem_prunes rate high (>100/sec) with mysql.performance.qcache_inserts rate similar to prune rate, and mysql.performance.qcache.utilization < 50%

Recommended action:

If on MySQL 5.7, consider disabling query cache (query_cache_type=0) as it's deprecated and often causes more harm than good in write-heavy workloads. Monitor mysql.performance.qcache_hits / (mysql.performance.qcache_hits + mysql.performance.com_select) to calculate hit ratio - if <20%, disable cache. If on MySQL 8.0+, query cache is not available. Implement application-level caching (Redis, Memcached) for better control and performance.