In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use query cache in mysql. I hope you will get something after reading this article. Let's discuss it together.
When a query statement is executed, the cache is queried first. However, it was removed after MySQL version 8.0 because this feature is not very practical.
My.cnf adds the following configuration. Restart MySQL to enable query caching.
Query_cache_type=1query_cache_size=600000
MySQL can also turn on query caching by executing the following command
Set global query_cache_type=1;set global query_cache_size=600000
As above, when query caching is enabled, the results will be returned directly in the cache under the same query conditions and data. The query conditions here include the query itself, the current database to be queried, the client protocol version number and other information that may affect the results. Therefore, the difference between any two queries on any character will cause the cache to miss. In addition, if the query contains any user-defined functions, storage functions, user variables, temporary tables, and system tables in the MySQL library, the query results will not be cached.
After the cache is established, MySQL's query cache system tracks each table involved in the query, and if these tables (data or structure) change, then all cached data related to this table will be invalidated.
Although caching can improve the query performance of the database, caching also brings additional overhead. It has to do a cache operation after each query and destroy it after invalidation. Therefore, it is prudent to turn on cached queries, especially for write-intensive applications. If enabled, you should control the size of the cache space reasonably. Generally speaking, it is appropriate to set the size to dozens of MB. In addition, you can use sql_cache and sql_no_cache to control whether a query statement needs to be cached:
Select sql_no_cache count (*) from usr; has finished reading this article. I believe you have some understanding of "how to use query cache in mysql". If you want to know more about it, please follow the industry information channel. Thank you for reading!
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.