An Entrepreneur, Coach, IT Consultant, Strategic Adviser, and a Traveler craving to explore and contribute to forming a better society.

Thursday, December 18, 2008

How to Query Caching in MySQL?

No comments :
(Explaining how to Query Caching in MySQL)

Keywords: MySQL, Caching, Query Caching, Query Optimization, Performance Optimization, MySQL Performance Optimization

Query
Will MySQL supports Query Caching?

Answer:
YES
MySQL supports query caching if done some changes in the configuration file my.ini
Under [mysqld] section you can add,
query_cache_type = #query_cache_value#
#query_cache_value # can be any of the following,
query_cache_type = 0 => Caching is disabled 
query_cache_type = 1 => Caching is enabled for all queries 
query_cache_type = 2 => this requires adding the keyword SQL_CACHE to the queries that are to be cached 
If defined “query_cache_type = 2”, then caching will be enabled for the queries which is mentioned SQL_CACHE in it.
Example
SELECT SQL_CACHE column1, column2 FROM table_name;
SELECT SQL_CACHE name, age FROM employees;

No comments :