qcache

编程入门 行业动态 更新时间:2024-10-12 18:21:15

<a href=https://www.elefans.com/category/jswz/34/1687731.html style=qcache"/>

qcache

高性能MySQL这本书中关于查询缓存有一段这样的描述:

 

Cache invalidations can happen because of fragmentation, insufficient memory, or
data modifications. If you have allocated enough memory to the cache and tuned the
query_cache_min_res_unit value properly, most cache invalidations should be due to
data modifications. You can see how many queries have modified data by examining
the Com_* status variables (Com_update, Com_delete, and so forth), and you can see
how many queries have been invalidated due to low memory by checking the Qcache_
lowmem_prunes status variable.

 

既然没有命中,肯定要有com_select,读之后要加到缓存中,要有qcache_inserts,既然是这样,我不解的是应该一次com_select就对应一次qcache_inserts阿,为什么qcache_inserts会比com_select小的多呢?原来是这样的:

 

The total number of SELECT queries is given by this formula:

Com_select + Qcache_hits+ queries with errors found by parser

 

The Com_select value is given by this formula:

Qcache_inserts + Qcache_not_cached + queries with errors found during the column-privileges check

 

总的select查询数等于com_select(没命中) + qcache_hits(命中) + 解析错误的,其中的com_select等于qcache_inserts(失效) + qcache_not_cache + 权限检查错误的。也就是说qcache_inserts这个计数不是表示没被缓存而进行的读,而是缓存失效而进行的读,没被缓存和缓存失效是两个概念,分别计数,但都会引起com_select。

 

参考:

.0/en/query-cache-status-and-maintenance.html

.html

 

还是要认真读官方文档阿。

更多推荐

qcache

本文发布于:2024-02-12 12:09:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1687733.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:qcache

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!