Turbo charging MySQL by setting up the query cache
To make sure MySQL uses the query cache, there are a few variables you need to set in the configuration file . Usually its my.cnf or my.ini so check on your server with the shell command locate , in our case we are running on a CentOS 5.2 distro and to its my.cnf located in /etc so we opened it by using : nano /etc/my.cnf
First, is the query_cache_type. There are three possible settings: 0 (for off, do not use), 1 (for on, cache queries) and 2 (on demand). To ensure it is always on, place:
query-cache-type = 1
in the configuration file.
The query_cache_type is set to ON now. However, there is one more to set, and that is the query_cache_size. If set to 0 (the default), the cache will be disabled. This variable determines the memory, in bytes, used for the query cache. For our purposes, we will set it to 20 MB:
query-cache-size = 20M
Hope that helped a little
And if you want to check out whats happening in the mySql cache just run this comand
mysql -e “SHOW STATUS LIKE ‘%qcache%’;”
|
|
|
|
|
|
Related posts:
- How To Set Up A Load-Balanced MySQL Cluster With MySQL 5.1 This tutorial is based on Falko Timme’s tutorial for MySQL...
- Moving mySQL DBs between servers Moving mySQL DBs from one server to another: mysqldump -uUSER...
- Linux Server Type: Restoring MySQL SimLink. If you’re unable to restart mysqld and troubleshooting the cause:...
- Taking backup of mysql database using cron Taking backup of mysql database using cron Create a file...
