Query Cache
發表於 : 2016-09-22 15:06:30
http://dev.mysql.com/doc/refman/5.7/en/query-cache.html
my.cnf
my.cnf
代碼: 選擇全部
query_cache_size = 32M
query_cache_type = 1
代碼: 選擇全部
mysql> SHOW STATUS LIKE 'Qcache%';
+-------------------------+----------+
| Variable_name | Value |
+-------------------------+----------+
| Qcache_free_blocks | 7 |
| Qcache_free_memory | 23406160 |
| Qcache_hits | 61343 |
| Qcache_inserts | 5256 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 5385 |
| Qcache_queries_in_cache | 1953 |
| Qcache_total_blocks | 4120 |
+-------------------------+----------+
8 rows in set (0.00 sec)
代碼: 選擇全部
mysql> set global query_cache_type = 0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global query_cache_type = 1;
ERROR 1651 (HY000): Query cache is disabled; restart the server with query_cache_type=1 to enable it
mysql> set global query_cache_type = 2;
ERROR 1651 (HY000): Query cache is disabled; restart the server with query_cache_type=1 to enable it