I have turned on query_cache, and allocated memory for it:
| query_cache_limit            | 1048576    |
| query_cache_min_res_unit     | 4096       |
| query_cache_size             | 16777216   |
| query_cache_type             | ON         |
| query_cache_wlock_invalidate | OFF        |
But queries are not cached:
| Qcache_free_blocks             | 1        |
| Qcache_free_memory             | 16768400 |
| Qcache_hits                    | 0        |
| Qcache_inserts                 | 0        |
| Qcache_lowmem_prunes           | 0        |
| Qcache_not_cached              | 163      |
| Qcache_queries_in_cache        | 0        |
| Qcache_total_blocks            | 1        |
I use Innodb as storage engine, without transactions. The sample query which is not cached:
select * from `feed-ts`.feeds where id < 10;
It returns just one row.
Any ideas?
There's a bug in MySQL.
The query cache simply doesn't get used for queries on InnoDB tables that are in a database with a hyphenated name (like feed-ts).  
"Renaming" your database seems to be the only solution for now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With