前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >qcache_inserts com_select 与缓存命中率

qcache_inserts com_select 与缓存命中率

作者头像
用户1148526
发布2019-05-25 19:38:13
6840
发布2019-05-25 19:38:13
举报
文章被收录于专栏:Hadoop数据仓库Hadoop数据仓库

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://cloud.tencent.com/developer/article/1433097

高性能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。

参考:

http://dev.mysql.com/doc/refman/5.0/en/query-cache-status-and-maintenance.html

http://www.wzsky.net/html/article/php/php2/15874.html

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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016年12月28日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 MySQL
腾讯云数据库 MySQL(TencentDB for MySQL)为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。其具备6大企业级特性,包括企业级定制内核、企业级高可用、企业级高可靠、企业级安全、企业级扩展以及企业级智能运维。通过使用腾讯云数据库 MySQL,可实现分钟级别的数据库部署、弹性扩展以及全自动化的运维管理,不仅经济实惠,而且稳定可靠,易于运维。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档