开发者

Does MySQL cache by default

Does MySQL cache queries by default开发者_开发问答 or does it only cache when the SQL_CACHE keyword is used in the query? What other things should I keep in mind when using MySQL caching?


The have_query_cache server system variable indicates whether the query cache is available:

mysql> SHOW VARIABLES LIKE 'have_query_cache'; | Variable_name | Value | | have_query_cache | YES | When using a standard MySQL binary, this value is always YES, even if query caching is disabled.

Several other system variables control query cache operation. These can be set in an option file or on the command line when starting mysqld. The query cache system variables all have names that begin with query_cache_. They are described briefly in Section 5.1.3, “Server System Variables”, with additional configuration information given here.

To set the size of the query cache, set the query_cache_size system variable. Setting it to 0 disables the query cache. The default size is 0, so the query cache is disabled by default.

Be careful not to set the size of the cache too large. Due to the need for threads to lock the cache during updates, you may see lock contention issues with a very large cache.

Quote taken from the MySQL Site http://dev.mysql.com/doc/refman/5.0/en/query-cache-configuration.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜