Forum Moderators: coopster
I am writing php scripts for an application. There are several queries like select * from table where name = .... and so on.
I would like such that once any unique query has been executed, it should be cached and should display quickly next time the same query is called unless the mysql table which is being accessed is updated or its timestamp changes.
Is this possible or there are better caching/speed improvements available?
Thanks
My concern is that I have around millions of different queries and I have set query-cache-size = 64M, but when I issue the command SHOW STATUS LIKE '%qcache%'; [Its almost down to 49 mb [Qcache_free_memory ] after just 11812 queries. What happens when it goes down to 0 mb
mysql> SHOW STATUS LIKE '%qcache%';
+-------------------------+----------+
¦ Variable_name ¦ Value ¦
+-------------------------+----------+
¦ Qcache_queries_in_cache ¦ 11812 ¦
¦ Qcache_inserts ¦ 11812 ¦
¦ Qcache_hits ¦ 6783 ¦
¦ Qcache_lowmem_prunes ¦ 0 ¦
¦ Qcache_not_cached ¦ 18 ¦
¦ Qcache_free_memory ¦ 49025296 ¦
¦ Qcache_free_blocks ¦ 1 ¦
¦ Qcache_total_blocks ¦ 27048 ¦
+-------------------------+----------+
Or since I have so many queries, should I increase query-cache-size to more? I have 2GB Ram.
mysql> SHOW STATUS LIKE '%qcache%';
+-------------------------+---------+
¦ Variable_name ¦ Value ¦
+-------------------------+---------+
¦ Qcache_queries_in_cache ¦ 38207 ¦
¦ Qcache_inserts ¦ 70526 ¦
¦ Qcache_hits ¦ 67446 ¦
¦ Qcache_lowmem_prunes ¦ 32319 ¦
¦ Qcache_not_cached ¦ 22 ¦
¦ Qcache_free_memory ¦ 6890888 ¦
¦ Qcache_free_blocks ¦ 1796 ¦
¦ Qcache_total_blocks ¦ 86610 ¦
+-------------------------+---------+
8 rows in set (0.00 sec)