Speed Up Mysql Query
One way of speeding up your website is enabling mysql query cache. this will cache all the queries that are more often used so that next time it provides results much quicker.
This method is good for the websites that are more into information providing rather than updating all the time. but anyway it is good to enable it.
we can get done this by setting these two parameters in mysql
query_cache_size=SIZE
This indicate the amount of memory allocated fro caching query results. The default value is 0 (0 indicates that query cache is turned off )
query_cache_type= OPTION
This parameter indicate the query cache type, below are the possible options
- 0 : Don’t cache results in or retrieve results from the query cache.
- 1 : Cache all query results except for those that begin with SELECT S_NO_CACHE.
- 2 : Cache results only for queries that begin with SELECT SQL_CACHE
So The Question, How to enable caching ?
Open up MySal Console and log in. now use the following command to set the query cache to 16Mb.
Hit below command to see status
the maximum size of individual query results that can be cached set to 1048576 using query_cache_limit system variable. Memory size in Kb.