1.查询缓存相关
mysql> show variables like '%query_cache%';
+------------------------------+----------+
| Variable_name | Value |
+------------------------------+----------+
| have_query_cache | YES |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 67108864 |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
+------------------------------+----------+
6 rows in set (0.00 sec)
have_query_cache 显示当前MySQL启动了查询缓存功能
query_cache_size 设置查询缓存的大小,以字节为单位,可以在/etc/my.cnf中设置
如query_cache_size= 64M。如果设置值为0表示关闭查询缓存
query_cache_limit 超过此大小的查询将不被缓存
mysql> show status like '%Qcache%';
+-------------------------+----------+
| Variable_name | Value |
+-------------------------+----------+
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 67099936 |
| Qcache_hits | 0 |
| Qcache_inserts | 0 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 12304 |
| Qcache_queries_in_cache | 0 |
| Qcache_total_blocks | 1 |
+-------------------------+----------+
8 rows in set (0.00 sec)
可以使用flush query cache;命令清空缓存
--转自
该贴由koei123转至本版2015-2-6 4:54:29