MySQL Query cache summary bitsCN.com
MySQL Query cache summary
You can use the following SQL statement to view the cache-related parameter status of the current query:
1
Show variables like '% query_cache % ';
The output result is similar to the following:
Query_cac
MySQL performance optimization and Architecture Design-Chapter 1 Utilization of Cache and Search in scalability design, mysql Optimization
Chapter 1 scalability design: Utilization of Cache and Search
Preface:
The scalable architecture solutions analyzed in the previous sections are basically centered on the database i
= 2097152;
set global query_cache_size = 600000;
The cache mechanism simply caches the SQL text and query results. If the same SQL statement is run, the server directly retrieves the results from the cache without parsing and executing the SQL statement. If the table is changed, all buffered queries using this table
Tags: MySQL query cache optimizerQuery 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
Query 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, and the result set of query is stored in the cache,
some features of MYSQL query cache, Oracle query cache can refer to http://www.oracle.com/technetwork/articles/ SQL /11g-caching-pooling-088320.html
If you have a table that does not change frequently and the server receives a large number of identical queries for the table
MySQL open query cache can have two ways to open the use of the set command to open, and the other is to directly modify the My.ini file directly set is very simple oh.Open the cache, set the cache size, specifically implemented as follows:1, modify the configuration file, under Windows is my.ini,linux under the my.cnf
that do not often change data and have a large number of identical SQL queries, the query cache will save a lot of performance.
Rules for MySQL to check cache hits
1. When checking the cache, MySQL does not parse, refresh, or parameterize the statements. It precisely uses t
MySQL server has an important feature since MySQL 4.0.1: Query Cache. In use, the query cache storesSELECTThe query text corresponds to the result sent to the client. If the same query is received later, the server will retrieve the result from the query cache, instead of re
, or you have explicitly stated that you need to use Query Cache), MySQL will directly HASH the received select statement in string mode based on the preset hash algorithm, then, go to the Query Cache to check whether the data has been cached. That is to say, if the select request is already in the cache, the data will
. Advantages and Disadvantages of query cache: No parsing or execution of SQL statements is required, of course, Syntax Parsing must first obtain the Query results from the Query Cache. The judgment rules of the Query Cache are not intelligent enough, which increases the Query Cache Usage threshold and reduces its effi
size on a 104-bit string to slide, to find the largest range of different numbers, with this interval as the module interval, so that the data stream can be evenly distributed in the various hash If the data flow through many causes the conflict chain list too long, you can build a multidimensional nested hash, the hash table upside down look, it is like a balanced N fork tree Ah, n fork trie tree is this? The hash function here is "take some bits",
as a string directly based on a pre-set hash algorithm, and then go directly to the query cache to find out if it is already cached. That is, if it is already in the cache, the select request will return the data directly, omitting all subsequent steps (such as parsing of SQL statements, optimizer optimizations, and requesting data from the storage engine), which greatly improves performance.Of course, the
: Sets the memory size that the query cache uses, default A value of 0, the size must be 1024 integer times, if not an integer multiple, MySQL will automatically adjust the minimum amount to achieve a multiple of 1024
query_cache_type: Control the query cache function switch, can be set to 0 (OFF), 1 ( ON) and 2 (DEMAND) of three, the meanings are as follow
/** Spark SQL Source Analysis series Article */Spark SQL can cache data into memory, and we can see that by invoking the cache table TableName A table can be cached in memory to greatly improve query efficiency.This involves the storage of data in memory, and we know that relational-based data can be stored as a row-ba
The MySQL query cache mechanism is one of the important mechanisms in the MySQL database. The following provides an in-depth analysis of the MySQL query cache mechanism for your reference.
The MySQL
Mysql buffer and cache settings
MySQL Adjustable settings can be applied to the entire mysqld process, or to a single client session.
Server Settings
Each table can be represented as a file on the disk. It must be opened first and then read. To speed up the process of reading data from files, mysqld caches these open f
the Query Cache to check whether the data has been cached. That is to say, if the select request is already in the cache, the data will be directly returned, thus omitting all subsequent steps (such as SQL statement parsing, optimizer optimization and Data Request to the storage engine), greatly improving performance.
Of course, Query Cache also has a fatal defe
Page table, TLB, Cache introduction (x86), tlbx86
Paging Model
Taking x86 as an example, intel processor's paging Unit processes 4 kb pages. 32-bit linear addresses (virtual addresses) are divided into three domains:-Directory, Directory, up to 10-Table, page Table, 10-Offset in the middle, Offset, 12-bit lower-the ad
1 , table Cacherelated parameters: Table_open_cacheSpecifies the size of the table cache. Whenever MySQL accesses a table, if there is room in the table buffer, the table is opened and
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.