In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
What this article shares to you is about how many parameters are involved in MySQL query cache, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
Query cache mainly involves two parameters, query_cache_size is used to set the query cache (query cache) size of MySQL, and query_cache_type is used to set the type of query cache to be used
You can view specific usage with the following command:
Mysql > show global status like 'qcache%'
+-+ +
| | Variable_name | Value |
+-+ +
| | Qcache_free_blocks | 1 | |
| | Qcache_free_memory | 195024544 | |
| | Qcache_hits | 0 | |
| | Qcache_inserts | 3 | |
| | Qcache_lowmem_prunes | 0 | |
| | Qcache_not_cached | 121 | |
| | Qcache_queries_in_cache | 1 | |
| | Qcache_total_blocks | 4 |
+-+ +
8 rows in set (0.00 sec)
The relevant parameters are explained as follows:
Qcache_free_blocks: the number of adjacent memory blocks in the cache. A large number means there may be fragments. Flush query cache will defragment the cache to get a free block.
Qcache_free_memory: free memory in the cache.
Qcache_hits: how many hits? you can see the basic hit effect of query cache through this parameter.
Qcache_inserts: increases every time you insert a query, and the number of hits divided by the number of inserts is the miss rate.
Qcache_lowmem_prunes: how many query are cleaned out of the query cache due to insufficient memory. Through the combination of Qcache_lowmem_prunes and Qcache_free_memory parameters, you can
Know more clearly whether the memory size of query cache in the system is really sufficient, and whether query is swapped out very frequently because of insufficient memory.
Qcache_not_cached: the number of queries that are not suitable for caching, usually because they are not SELECT statements or use functions such as now ().
Qcache_queries_in_cache: the number of queries and responses currently cached.
Qcache_total_blocks: the number of blocks in the cache.
About the configuration of query_cache:
Mysql > show variables like 'query_cache%'
+-+ +
| | Variable_name | Value |
+-+ +
| | query_cache_limit | 1048576 | |
| | query_cache_min_res_unit | 4096 | |
| | query_cache_size | 195035136 | |
| | query_cache_type | ON |
| | query_cache_wlock_invalidate | OFF |
+-+ +
5 rows in set (0.00 sec)
Each field is explained as follows:
Query_cache_limit: queries that exceed this size will no longer be cached.
Query_cache_min_res_unit: the minimum value of the cache block.
Query_cache_size: cache size valu
Query_cache_type: cache type, which determines what kind of query to cache.
Query_cache_wlock_invalidate: indicates whether the read request should wait for write lock to release resources before querying or allowing direct query when other clients are writing to the MyISAM table.
Read the result from query cache. Default is FALSE.
Query cache fragmentation rate = Qcache_free_blocks/Qcache_total_blocks * 100%
Query cache utilization = (query_cache_size-Qcache_free_memory) / query_cache_size * 100%
The query cache utilization is below 25%, which means that the query_cache_size setting is too large and can be reduced appropriately.
Query cache hit ratio = (Qcache_hits-Qcache_inserts) / Qcache_hits * 100%
The above is the number of parameters involved in the MySQL query cache, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.