on, place:
Query-cache-type = 1
In the configuration file. If you started the server has only made this change, you would the following cache variables set:
Mysql> show VARIABLES like '%query_cache% ';
+-------------------+---------+
| variable_name | Value |
+-------------------+---------+
| Have_query_cache | YES
return results beyond the qualified value of this parameter. Query_cache_min_res_unit: The minimum memory block for storing the cache; Calculation method: (query_cache_size-qcache_free_memory)/qcache_queries_in_cache Query_cache_size: Total space, in bytes, size must be 1024 times times the number. When MySQL starts, it allocates and immediately initializes a me
space problem, that is, when this situation occurs, we need to measure the efficiency of the cache. Of course, you also have to combine the above two points to judge:three. Querying cache-related variables1Mysql> Show global variables like'query_cache%';2+------------------------------+---------+3| variable_name | Value |4+------------------------------+---------+5| Query_cache_limit |1048576|6| Query_cach
Label:Https://help.aliyun.com/knowledge_detail/41717.html?spm=5176.7841698.2.11.aCvOXJ RDS for MySQL lookup cache (query cache) The settings and use of
function and scope of application
Principle
Limit
Set up
Validation effect
1. Function and scope of applicationFunction:
The following describes the MySQL cache variable query in detail and analyzes the steps in the MySQL cache variable query process. If you are interested in this, take a look.
mysql
The following articles mainly describe the actual operation steps for MySQL to query cache and the description of more than 20 application codes of MySQL to query cache, the following describes how to view the
Tags: select nts its LOB-run statement row ODBQuery cache:Cached data: k/v, which is a key-value pair;Key: The hash value of the query statement;Value: Query result of query statement;To determine whether the cache hits the standard:By comparing the hash value of the whole query
disable query caching, simply set the size of Query_cache_size to 0 at startup.Query mitigation may improve the performance of the system in some cases, but it does not mean that the performance of the system can be improved in any situation, and in some cases it may even degrade the performance of the system. Such as1) There is a large divergence in the Level setting
/qcache_total_blocks * 100% If the query cache fragmentation rate exceeds 20%, you can use flush query cache to defragment the cache. Or try reducing query_cache_min_res_unit if your queries are small data volumes. Query
Principle
Querycache (hereinafter referred to as QC) is based on SQL statements to cache. If a SQL query starts with SELECT, the MySQL server tries to use QC for it. Each cache is saved as a key with SQL text. SQL text is not processed until the QC is applied. In other words, two SQL statements, as long as the differen
Mysql caches the same SQL statement and completes it in an instant during the second run. to clear the cache, you can use the following method to optimize an SQL statement, it was found that a slow SQL statement (nearly 1 minute) was completed in an instant during the second operation (0.00sec)
This is because mysql caches the same SQL statement. the server di
Query_cache_type How to use query cachingIn general, we will set the Query_cache_type to on, which should be on by defaultMySQL>SELECT@ @query_cache_type; + -- ------------------+ | @ @query_cache_type | + -- ------------------+ | on | + -- ------------------+Query_cache_type has 3 values of 0 for closing the query cache off,1 on behalf of the on
query-cache may not always be useful; 4. Query-cache returns a result set from Query-cache only if the SELECT statement is exactly the same and the table does not change, note that the same refers to the byte sequence , that is,
store information such as type, size, and data.
When the server starts, it initializes the memory required by the cache and is a complete free block. When the query results need to cache, first from the free block to request a block of data is larger than the parameter query_cache_min_res_unit configuration, even if
at the level of the SQL statement and it is not possible to do so. In a small website, query cache helps, but with the increase in the size of the site, query cache will do more harm than benefit.* The amount of memory available to quer
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.