Mysql optimization by configuring the query cache
In Ubuntu (debian) the query cache settings can be changed in the following file /etc/mysql/my.cnf
Use the following command to edit the file
In this file you can find following settings.
Query Cache options SQL_CACHE
SQL_NO_CACHE
We can check whether cache enabled in mysql database
We can set Query_cache by queries
If "query_cache_size " has value '0', then query cache is disabled, in the mysql environment. Also need to take care about the setting the query_cache_size with huge value. that will affect the system. For more information about the query caching you can visit http://dev.mysql.com/doc/refman/5.1/en/query-cache.html
In Ubuntu (debian) the query cache settings can be changed in the following file /etc/mysql/my.cnf
Use the following command to edit the file
nano /etc/mysql/my.cnf or vi /etc/mysql/my.cnf
In this file you can find following settings.
# Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
Query Cache options SQL_CACHE
SELECT SQL_CACHE id, name FROM students;
SQL_NO_CACHE
SELECT SQL_NO_CACHE id, name FROM students;
We can check whether cache enabled in mysql database
mysql> SHOW VARIABLES LIKE 'have_query_cache';
We can set Query_cache by queries
mysql>SET GLOBAL query_cache_size = 41984;
If "query_cache_size " has value '0', then query cache is disabled, in the mysql environment. Also need to take care about the setting the query_cache_size with huge value. that will affect the system. For more information about the query caching you can visit http://dev.mysql.com/doc/refman/5.1/en/query-cache.html