My database have been up and running for a while with query cache enabled, but there are 0 hits. I have tried to check the settings but I am not sure what the problem is. Using InnoDB.
mysql> SHOW VARIABLES LIKE 'query_cache%';
+------------------------------+------------+
| Variable_name | Value |
+------------------------------+------------+
| query_cache_limit | 268435456 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 4294967296 |
| query_cache_strip_comments | OFF |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
+------------------------------+------------+
mysql> SHOW STATUS LIKE 'Qcache%';
+-------------------------+------------+
| Variable_name | Value |
+-------------------------+------------+
| Qcache_free_blocks | 622 |
| Qcache_free_memory | 4291758416 |
| Qcache_hits | 0 |
| Qcache_inserts | 1471501 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 8995948 |
| Qcache_queries_in_cache | 2269 |
| Qcache_total_blocks | 5199 |
+-------------------------+------------+
Any ideas ? I saw some other similar questions like this - the answer just suggests turning it off though without any good explanation except "the InnoDB Storage Engine likes to play traffic cop with the query cache".
It is actually recommended to disable the query cache completely in newer versions of MySQL, unless you know you need it.
In any case, a caching layer like Redis is probably going to be more effective than the query cache, though it does take application support.
– Micah Yoder Nov 21 '14 at 21:25