MySQL Query cache summary

Source: Internet
Author: User
Tags mysql query

/*

Name explanation

Sql_cache query Results cached (valid when query_cache_type=demand)

Sql_no_cache query results are not stored in cache

Query_cache_size indicates the size of the cache

Query_cache_type Query Cache session type (0=off close query cache 1=on on 2=demand manual via Sql_cache and Sql_no_cache control)

QUERY_CACHE_LIMIT Specifies the maximum query results that a single query can cache

Query_cache_min_res_unit the minimum cache block size allocated to the system, the default is 4KB, and the size of this value is directly related to the generation of fragmentation

Query_cache_wlock_invalidate on/OFF when the query table is locked, if the query hits the cache, is it possible to return the hit result directly

*/

/* Current Query cache configuration condition */

SHOW VARIABLES like '%query_cache% '


/*

Reset Query Cache */

RESET QUERY CACHE

/* Query Cache defragmentation */

FLUSH QUERY CACHE


/*

Current query Cache condition

Qcache_free_blocks: The number of contiguous memory blocks in the cache. A large number indicates that there may be fragmentation. FLUSH QUERY Cache organizes the fragments in the cache to get a free block.

Qcache_free_memory: Free memory in the cache.

Qcache_hits: Increases each time the query hits the cache

Qcache_inserts: Increases each time a query is inserted. The number of hits divided by the number of inserts is not the ratio.

Qcache_lowmem_prunes: The number of times that the cache is out of memory and must be cleaned up to provide space for more queries. This number is best seen over a long period of time, and if the number is growing, it can mean that fragmentation is very serious, or that there is little memory. (The above free_blocks and free_memory can tell you which kind of situation)

Qcache_not_cached: The number of queries that are not appropriate for caching, usually because these queries are not a SELECT statement or are using functions such as now ().

Qcache_queries_in_cache: The number of queries (and responses) that are currently cached.

Qcache_total_blocks: The number of blocks in the cache.

*/

SHOW STATUS like ' qcache% '


MySQL Query cache summary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.