博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql 缓存
阅读量:2391 次
发布时间:2019-05-10

本文共 1703 字,大约阅读时间需要 5 分钟。

从mysql4.1版本之后新增的功能。

作用:存储select查询的文本以及相应结果。如果随后收到一个相同的查询,则不再解析和执行查询,而是直接从缓存中得到查询结果。

mysql> show variables like '%query_cache%';+------------------------------+---------+| Variable_name                | Value   |+------------------------------+---------+| have_query_cache             | YES     || query_cache_limit            | 1048576 || query_cache_min_res_unit     | 4096    || query_cache_size             | 1048576 || query_cache_type             | OFF     || query_cache_wlock_invalidate | OFF     |+------------------------------+---------+6 rows in set (0.00 sec)
变量 例子 描述
have_query_cache YES 表明服务器在安装时是否配置了告诉缓存
query_cache_limit 1048576
query_cache_min_res_unit 4096
query_cache_size 1048576 表明缓存区的大小,单位为MB
query_cache_type OFF 变量从0到2,1或者off(缓存关闭),1或者on(缓存打开,使用SQL_NOCACHE提示的select除外),2或者demand(只带有SQL_CACHE的select语句提供高速缓存)
query_cache_wlock_invalidate OFF

缓存监控

mysql> show status like '%Qcache%';+-------------------------+---------+| Variable_name           | Value   |+-------------------------+---------+| Qcache_free_blocks      | 1       || Qcache_free_memory      | 1031352 || Qcache_hits             | 0       || Qcache_inserts          | 0       || Qcache_lowmem_prunes    | 0       || Qcache_not_cached       | 33048   || Qcache_queries_in_cache | 0       || Qcache_total_blocks     | 1       |+-------------------------+---------+8 rows in set (0.00 sec)
Variable_name Value 描述
Qcache_free_blocks 1 查询缓存中的空闲内存块的数目
Qcache_free_memory 1031352 查询缓存的空闲内存数
Qcache_hits 0 缓存采样数数目
Qcache_inserts 0 被加入到缓存中的查询数目
Qcache_lowmem_prunes 0 因为缺少内存而被删除的查询数目
Qcache_not_cached 33048 没有被缓存的查询数目(不能被缓存的,或由于QUERY_CACHE_TYPE)
Qcache_queries_in_cache 0 在缓存中已注册的查询数目TYPE
Qcache_total_blocks 1 查询缓存中的块的总数目

转载地址:http://lhqab.baihongyu.com/

你可能感兴趣的文章
Safely Dumping Hashes from Live Domain Controllers
查看>>
sgx模拟器
查看>>
SGX相关资源
查看>>
nessus 购买地址
查看>>
Google Security Architecture
查看>>
web server信息收集(附带plesk xday)
查看>>
JBoss AS Administrative Console Password Disclosure
查看>>
Securely Developing on Mobile
查看>>
ModSecurity Updates: Nginx Stable Release and Google Summer of Code Participation
查看>>
Java Web 三层架构详解
查看>>
iphone for PPT遥控器 MyPoint PowerPoint Remote
查看>>
ZPanel 10.0.0.2 Remote Command Execution
查看>>
Using Mimikatz Alpha or Getting Clear Text Passwords with a Microsoft Tool
查看>>
宁皓网bootstrap
查看>>
Hive作业优化总结(来自一号店)
查看>>
九.redis学习笔记之虚拟内存
查看>>
java ireport jasperreport 配套使用(三) 使用Parameters
查看>>
关于二维数组和指向指针的指针
查看>>
http get post head
查看>>
关于C语言中函数调用和参数传递机制的探讨
查看>>