# Question about percona Query Cache Enhancements

**URL:** <https://forums.percona.com/t/question-about-percona-query-cache-enhancements/1861>\
**Category:** Other MySQL® Questions\
**Created:** [August 8, 2012, 9:19pm UTC](https://forums.percona.com/t/question-about-percona-query-cache-enhancements/1861 "2012-08-08T21:19:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rj03hou](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@rj03hou](https://forums.percona.com/u/rj03hou)\
**Post date:** [August 8, 2012, 9:19pm UTC](https://forums.percona.com/t/question-about-percona-query-cache-enhancements/1861/1 "2012-08-08T21:19:29Z")

</div>

Read your document,you said the Percona Server disabling the cache completely.  
I want to ask in the standard mysql version,when we set query\_cache\_type=0,what happens?  
Still lock,but check query\_cache\_type=0,and return immediately?The lock is not disable completely and make some cpu consume?

---

<div class="post-metadata">

**Author:** ![sterin](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@sterin](https://forums.percona.com/u/sterin)\
**Post date:** [August 9, 2012, 6:07am UTC](https://forums.percona.com/t/question-about-percona-query-cache-enhancements/1861/2 "2012-08-09T06:07:55Z")

</div>

This:  
Quote:

> [@](#):
>
> Still lock,but check query\_cache\_type=0,and return immediately?

Should be written as:  
Quote:

> [@](#):
>
> Still lock,but check query\_cache\_type=0,and return immediately after consuming some time and cpu!

The definition of immediately if you do something 1000-3000 times a second can be after a proportionally very long time ;).

---

<div class="post-metadata">

**Author:** ![rj03hou](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@rj03hou](https://forums.percona.com/u/rj03hou)\
**Post date:** [August 10, 2012, 3:14am UTC](https://forums.percona.com/t/question-about-percona-query-cache-enhancements/1861/3 "2012-08-10T03:14:20Z")

</div>

/\* Testing ‘query\_cache\_size’ without a lock here is safe: the thing we may loose is that the query won’t be served from cache, but we save on mutex locking in the case when query cache is disabled. See also a note on double-check locking usage above. \*/ if (is\_disabled() || thd-\>locked\_tables\_mode || thd-\>variables.query\_cache\_type == 0 || query\_cache\_size == 0) goto err;

I read the code,I find the check section is same and don’t find anything different with the standard mysql version.
