query_cache_size:

  • MySQL 4 provides one feature that can prove very handy – a query cache. In a situation where the database has to repeatedly run the same queries on the same data set, returning the same results each time, MySQL can cache the result set, avoiding the overhead of running through the data over and over and is extremely helpful on busy servers.

To define Query Cache in My.cnf, Just add the follwoing line

query_cache_size=32M

To Verify Query cache, pass the following command in Mysql

 show status like 'qcache%';
mysql>  show status like 'qcache%';
+-------------------------+---------+
| Variable_name           | Value   |
+-------------------------+---------+
| Qcache_free_blocks      | 957     |
| Qcache_free_memory      | 3331504 |
| Qcache_hits             | 1046314 |
| Qcache_inserts          | 939847  |
| Qcache_lowmem_prunes    | 177821  |
| Qcache_not_cached       | 44523   |
| Qcache_queries_in_cache | 5804    |
| Qcache_total_blocks     | 14211   |
+-------------------------+---------+
8 rows in set (0.00 sec)

Post By Gishore J Kallarackal (2,121 Posts)

Gishore J Kallarackal is the founder of techgurulive. The purpose of this site is to share information about free resources that techies can use for reference. You can follow me on the social web, subscribe to the RSS Feed or sign up for the email newsletter for your daily dose of tech tips & tutorials. You can content me via @twitter or e-mail.

Website: → Techgurulive

Connect