Useful MySQL Query Cache Commands

This simple set of commands should help you managed the MySQL Query Cache.

What is the MySQL Query Cache?

The MySQL Query Cache stores the text of a SELECT statement together with the corresponding result. If an identical statement is received later, the server retrieves the results from the query cache. The MySQL Query Cache is shared among sessions, so a result set generated by one client can be sent in response to the same query issued by another client.

How to see the size of the MySQL Query Cache

SHOW VARIABLES LIKE 'query_cache_size';

How to see the MySQL Query Cache status

SHOW STATUS LIKE 'Qcache%';

How to set the MySQL Query Cache

SET GLOBAL query_cache_size = X;

where X is the size you want

How to reset the MySQL Query Cache

RESET QUERY CACHE;

This MySQL Query Cache documentation may also be useful



Comments

  1. Anvesh Patel September 1st

    Comment Arrow

    Nice Article !
    I have already shared this article with my friends.
    I have also worked around this MySQL Query Cache and created my research note on my blog.
    Please visit my blog.
    For basic theory:
    http://www.dbrnd.com/2015/08/mysql-query-cache/
    For basic configuration:
    http://www.dbrnd.com/2015/08/mysql-query-cache-configuration/


Add Yours

  • Author Avatar

    YOU


Comment Arrow




About Author

Robert

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning hands down.