Mysql cache function analysis:
1. The key Generation Principle of the mysql cache function is to generate a unique key based on the select statement according to certain hash rules. The select result generates a value, that is, key => value.Therefore, for the cache, select s
Query Cache (querycache) saves the full result returned by the query. When the query hits the cache, MySQL returns the results immediately, skipping the parsing, optimization, and execution phases. Official results in specific environmental tests (detailed in the official documentation):1. If a simple query is made on a table
MySQL query Cache
When the query cache (QC) function is enabled for your database, the database puts the results in QC when executing the SELECT statement. When the same select request is processed, the database will obtain results from QC without querying the data table.
In this era of "
Basic MySQL Data Table operation 2: Table Structure View, modification, and table operation
1. view the data table structure
1) view the basic table structure statement DESCRIBE
Syntax:DESCRIBETable Name;
Example:
try not to use dynamic annotations. In PHP's MySQL extensions, SQL annotations are not removed. That is, three of SQL is stored in three different caches, although their results are the same.
SELECT * from people where name= ' surfchen ';
SELECT * from people where/*hey~*/name= ' surfchen ';
SELECT * from people where name= ' surfchen ';
Currently only SELECT statements will be cache, other similar show,u
size is modified, all caches are emptied and reinitialized. Therefore, it is not recommended to modify this size, preferably in the first design, this memory should not be too large. - 3>. Query_cache_min_res_unit: +Minimum memory block for storing cache (query_cache_size-qcache_free_memory)/Qcache_queries_in_cache is able to get an ideal value A 4>. Query_cache_limit: at the maximum value of a single cached object is not cached when it is exceeded,
of fragmentation query_cache_limit: Maximum value of a single cached object, not cached when out of bounds; manual use of Sql_no_ The cache can be artificially avoided by attempting to buffer the return out of this parameter qualified statement query_cache_wlock_invalidate: If a table is locked by another user connection, the result is still returned from the cache
Redis for beginners (2) -- using Redis as the Mysql database cache, redismysql
Two problems must be solved when Redis is used as the Mysql database cache. First, determine the data structure used to store data from Mysql. After determining the data structure, consider the id
considered to be different queries and are cached separately. 2. Query cache related parametersMySQL>like'%query_cache%'; 3. A simple example:MySQL> use zzlp;
MySQL> show Tables; MySQL>Selectcount(*fromuser; #Qcache_hits表示sql查询在缓存中命中的累计次数, is the cumulative value of
mysql>like'qcache _hits'; #连续查询两次
The MySQL query cache saves the full results of the query return. When the query hits the cache, the result is immediately returned, skipping the parsing, optimization, and execution phases.
The query cache tracks each table involved in the query, and if the
MySQL Status View qps/tps/cache Hit rate view running MySQL Status View monitor running MySQL, one way is to view MySQL running status. (1) QPS (query amount per second) qps = Questions (or Queries)/secondsmysql > show global status Like ' question% '; (2) TPS (transaction
Two problems must be solved when Redis is used as the Mysql database cache. First, determine the data structure used to store data from Mysql. After determining the data structure, consider the identifier used as the key of the data structure. Intuitively, data in Mysql is stored by
Label:Knowledge Preparation: 1. What is the query-cache of MySQL? MySQL can cache the execution of the SELECT statement and the result set corresponding to the SELECT statement, and return the result directly the next time the same SELECT statement is invoked, instead of executing the SELECT statement again. Due to the
that the two are associated. So the foreign key must be created from the table to find the connection to the primary table , and the table is responsible for maintaining the relationship between the two.We will first use the following command to create the department table and staff
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
Label:MySQL Memory structure InnoDB Primary index is clustered index, index and data common table space, for InnoDB, data is index, index is data. The biggest difference between the InnoDB cache mechanism and the MyISAM cache mechanism is that INNODB is not just a cache index, but also caches the data. InnoDB
Tags: pros and cons MySQL client information benefitsQuery Cache principleWhen MySQL receives a select type of query, MySQL hashes the query to get a hash value and then matches the hash value to the query cache, if there is no match, The hash value is stored in a hash list,
Label: to use Redis as a MySQL database cache, 2 issues must be resolved.
First, you should determine what data structure is used to store your MySQL-based information, and after determining the data structure, consider what identity is used as the key to the data structure. Visually, the data in MySQL is stored on a
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.