By default there is no caching enabled in MYSQL, to improve performance, add a little memory to the cache to help speed up responses by storing queries.
in mysql type
show variables like 'query_cache_size';
this will show the value of the current cache size, to modify the cache size use ->
SET GLOBAL query_cache_size = 16777216;
That sets the cache to 16mb of each instance of mysql that runs. Don’t over do this value if you are running on a VPS with limited resources.
How do you know if your cache size is right? Check out the Qcaches and look at the results
show status like "qcache%";
+————————-+———-+
| Variable_name | Value |
+————————-+———-+
| Qcache_free_blocks | 42 |
| Qcache_free_memory | 16431944 |
| Qcache_hits | 339 |
| Qcache_inserts | 759 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 179 |
| Qcache_queries_in_cache | 188 |
| Qcache_total_blocks | 451 |
+————————-+———-+
The lowmem_prunes is the important value here, it counts the number of times the cache had to be free up spaces to cache a new result set.
Recent Comments