Waiting on query cache mutex

Hi All

I’m seeing a lot of “Waiting on query cache mutex” threads when I’m running a lot of small updates on a particular table (InnoDB).

When this happens all the DBs on the server basically grind to a halt. I’ve disabled the query cache on the server entirely for the time being and this prevents them from completely grinding to a halt when the update is running, but has had a significant impact on query response times the rest of the time.

Is it feasible to disable the query cache whilst running the updates and re-enable as soon a it’s completed or is there some alternate solution?

Thanks a lot :slight_smile:

You could try it:
SET GLOBAL query_cache_size = 0;
and after your updates, change it back to its default value. But you will face the ‘significant impact’ during your update queries, especially during the updates when your server is doing extra work. Maybe it is possible to implement caching in your application.

I’ve just spotted that the query cache was set far too big (2Gb), I think reducing it will probably alleviate the problem. And yes I’d love to implement application layer caching, but this is something we’ve inherited and could do with a quicker solution for the short term. Thanks for your help.