Home > Database > Mysql Tutorial > body text

mysql 设置查询缓存

WBOY
Release: 2016-06-07 18:01:31
Original
870 people have browsed it

查询缓存绝不返回过期数据。当数据被修改后,在查询缓存中的任何相关词条均被转储清除。

可将如下语句
query_cache_size = 268435456
query_cache_type = 1
query_cache_limit = 1048576
存放到/etc/my.cnf文件的[mysqld]下
然后重启mysql数据库
service mysqld restart
就会启动mysql的缓存机制Query Cache。 在使用中,查询缓存会存储一个 SELECT 查询的文本与被传送到客户端的相应结果。
如果之后接收到一个同样的查询,服务器将从查询缓存中检索结果,而不是再次分析和执行这个同样的查询。
注意:查询缓存绝不返回过期数据。当数据被修改后,在查询缓存中的任何相关词条均被转储清除。
适用于更改不是太频繁的表且有大量相同查询的情况
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!