In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces you how to analyze the practical application code of MySQL query cache, the content is very detailed, interested friends can refer to, hope to be helpful to you.
The following mainly introduces the actual application code of MySQL query cache and the description of viewing MySQL query cache size, defragmentation, clearing cache and monitoring MySQL query cache performance, the following is the specific content description, I hope it will be helpful in your future study.
MySQL > select @ @ query_cache_type
+-+
| | @ @ query_cache_type |
+-+
| | ON |
+-+
MySQL > set query_cache_type=off
MySQL > set query_cache_type=on; 100.Com
MySQL >
MySQL > select sql_cache id, title, body from article
MySQL > select sql_no_cache id, title, body from article
MySQL > show variables like have_query_cache
+-+ +
| | Variable_name | Value |
+-+ +
| | have_query_cache | YES |
+-+ + phP100.Com
1 row in set (0.00 sec)
View the size of the MySQL query cache
MySQL > select @ @ global.query_cache_size
+-+
| | @ @ global.query_cache_size |
+-+
| | 16777216 |
+-+
1 row in set (0.00 sec)
MySQL > select @ @ query_cache_size
+-+ phP100.Com
| | @ @ query_cache_size |
+-+
| | 16777216 |
+-+
1 row in set (0.00 sec)
View the maximum cache results, and if the result set is greater than that number, it is not cached.
MySQL > select @ @ global.query_cache_limit
+-+
| | @ @ global.query_cache_limit |
+-+
| | 1048576 |
+-+
1 row in set (0.00 sec)
Defragmentation
MySQL > flush query cache
->
Query OK, 0 rows affected (0.00 sec)
Clear cach
MySQL > reset query cache phP100.Com
->
Query OK, 0 rows affected (0.00 sec
Monitor MySQL query cache performance:
MySQL > flush tables
Query OK, 0 rows affected (0.04 sec)
MySQL > show status like qcache%
+-+ +
| | Variable_name | Value |
+-+ +
| | Qcache_free_blocks | 1 | |
| | Qcache_free_memory | 16768408 | |
| | Qcache_hits | 6 | |
| | Qcache_inserts | 36 | PhP100.Com |
| | Qcache_lowmem_prunes | 0 | |
| | Qcache_not_cached | 86 | |
| | Qcache_queries_in_cache | 0 | |
| | Qcache_total_blocks | 1 | |
+-+ +
8 rows in set (0.06 sec)
See how many pieces of information are in the current cache:
MySQL > show status like qcache_q%
+-+ +
| | Variable_name | Value |
+-+ +
| | Qcache_queries_in_cache | 0 | |
+-+ +
1 row in set (0.00 sec)
This is the end of the practical application code analysis on how to carry out the MySQL query cache. I hope the above content can be helpful to everyone and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.