Query Cache,看上去很美

查看了线上的query_cache,利用率非常低下:
mysql> show status like '%QCache%';
+-------------------------+------------+
| Variable_name           | Value      |
+-------------------------+------------+
| Qcache_free_blocks      | 17638      |
| Qcache_free_memory      | 78529224   |
| Qcache_hits             | 777550194  |
| Qcache_inserts          | 1801925951 |
| Qcache_lowmem_prunes    | 25952293   |
| Qcache_not_cached       | 667738421  |
| Qcache_queries_in_cache | 35621      |
| Qcache_total_blocks     | 88908      |
+-------------------------+------------+
8 rows in set (0.00 sec)

感觉我们设置的query_cache太大了:
query_cache_size        =128M
query_cache_limit       = 512M

Query Cache有如下规则,如果数据表被更改,那么和这个数据表相关的全部Cache全部都会无效,并删除之。这里“数据表更改”包括: INSERT, UPDATE, DELETE, TRUNCATE, ALTER TABLE, DROP TABLE, or DROP DATABASE等。

参考:
http://www.orczhou.com/index.php/2009/08/query-cache-1/
http://www.cnblogs.com/sunss/archive/2010/10/13/1850407.html

你可能感兴趣的:(cache)