Knowledge preparation :

  1、mysql Of query-cache What is it? ?

     mysql We can complete the execution of select Sentence and this select The result set corresponding to the statement is cached ; Call the same next time select Statement to return the result directly , It's not another execution select sentence .

Because of the lack of this step , So the return result is faster .mysql In order to guarantee the cached result set and execute again select Statement, the result set returned is consistent , therefore ;mysql To judge select sentence

The tables used are unchanged , If so, the cached result set will be invalidated , In order to get the right result mysql It can only be select Statement again ;

  2、 What to pay attention to :

     1、query-cache It's in each session Shared between .

     2、query-cache If the setting is too large, the maintenance cost will increase accordingly , At this point, it's going to affect performance .

3、 In order to confirm query-cache Is it useful in the current business scenario , The best way is to test ; And over time , What worked before query-cache It doesn't always work ;

4、query-cache Only in select Only when the statements are exactly the same and the table has not been changed can the query-cache Returns the result set , Note that the same here refers to the sequence of bytes

The same on ; in other words select and SELECT It's going to be treated like two different things ;select and select It could also be treated as two different things , Because they have something to use

Different character sets , And we can't see that ;

5、 If one select A query is a subquery of a query , So this select And the results of that will not be cached , in other words query-cache Only the final results are cached .

6、 If one select It is defined in stored function、event、trigger Then its result set will not be cached .

7、 Even if it's available query-cache Result set , If the user's permission is not correct, it will not be returned .

8、 The change statements of the table include :insert ,update,delete,truncate table,alter table,drop table,drop database.

9、 If select If there are uncertain functions in the result set, the result set will not be cached .

To configure query-cache:

    1、have_query_cache This variable Used to detect query_cache Open or not , Note that if it's a binary package installation mysql This value will always be YES; So it doesn't work .

    2、 If you want to shut down query_cache that query_cache_size Parameters query_cache_type The parameters are set to 0.

    3、query_cache_limit Controls the maximum size of a result set .

    4、flush query cache and reset query cache Used to remove query_cache ; The two effects are equivalent .

    5、 If a query goes query-cache that Qcache_hits This status Will add 1、 Otherwise Com_select Will add 1.

  

MySQL--query-cache More articles about

  1. MySQL Query Cache Related issues

    Recently, people often ask me MySQL Query Cache Related issues , Just sort it out MySQL Query Cache The content of , For reference . seeing the name of a thing one thinks of its function ,MySQL Query Cache It's used to cache and Qu ...

  2. MySql Query Cache Optimize

    query cache principle When mysql Receive one select Type of query when ,mysql It's about this one query Conduct hash Calculate to get a hash value , And then through the hash It's worth it query cache Middle to match ...

  3. mysql query cache The query cache

    Check out this blog post , And verify that ( The verification result is consistent with the blog ): https://blog.csdn.net/carmazhao/article/details/7088530 mysql Query caching is enabled by default . Set up check ...

  4. MySQL And query cache

    Open the website in the morning , Saw the Percona The latest news about mysql query cache The article : https://www.percona.com/blog/2015/08/07/mysql-qu ...

  5. MySQL Troubleshoting:Waiting on query cache mutex Tencent Database Engineer : The southern wind

    http://blog.itpub.net/26515977/viewspace-1208188/            Today is MySQL Query Cache The Kang is broken . A lot of online Waiting on ...

  6. MySQL Troubleshoting:Waiting on query cache mutex

    Today is MySQL Query Cache The Kang is broken . A lot of online Waiting on query cache mutex So what is Query Cache? QC The cache is the entire SELECT The result set . Instead of clinging to ...

  7. mysql And Query Cache

    1,QueryCache Implementation principle of : 1. At present, only select The statement will be cache, Other similar show,use The statement of the will not be cache. 2. Two SQL sentence , As long as the difference is even one character ( For example, case is different : One more ...

  8. 1011MySQL Query Cache Learning notes

    from :http://blog.chinaunix.net/uid-16844903-id-321156.html Test environment MySQL 5.5 innodb_version 1.1.6 MySQL Q ...

  9. 011-MySQL Query Cache Query cache setting operation

    One . summary MySQL Query Cache Will cache select Inquire about , It is on by default during installation , But if the table is INSERT, UPDATE, DELETE, TRUNCATE, ALTER TABLE, ...

  10. MySQL cache Query Cache

    QueryCache( Hereinafter referred to as QC) It's based on SQL Statement to cache Of . One SQL If you use select start , that MySQL The server will try to make use QC. Every Cache It's all about SQL The text serves as key To save . In response to ...

Random recommendation

  1. Yii2 How to use events

    Original address :http://www.fancyecommerce.com/2016/04/29/yii2-%E4%BD%BF%E7%94%A8event-1-%EF%BC%8C%E5%A6%82%E4%B ...

  2. Bootstrap The page layout 6 - BS Convert the existing fixed width layout into a responsive layout

    Import file first bootstrap-responsive.css <link href="bootstrap/css/bootstrap-responsive.css" rel= ...

  3. Android Auto shutdown code

    http://www.open-open.com/lib/view/open1409209890713.html To realize the function of automatic shutdown, the mobile phone needs to have root jurisdiction , If the phone has root jurisdiction , When running the program , Will mention ...

  4. session Verify login

    Because a website has many pages , If every page is written with inspection session Is it empty , It's too troublesome , So write a tool class , It's convenient . 1 First, create a class library Common 2, Then add a reference to the class library 3 stay Common Inherit :Sys ...

  5. UVa - 1618 - Weak Key

    Cheolsoo is a cryptographer in ICPC(International Cryptographic Program Company). Recently, Cheolsoo ...

  6. Hibernate Frame notes 03 Table operation many to many configuration

    Catalog 1. The relationship between database tables 1.1 One-to-many relation 1.2 Many to many relationship 1.3 One to one relationship [ understand ] 2. Hibernate One to many association mapping of 2.1 Create a project , To introduce the relevant jar package 2.2. establish ...

  7. python———day01

    One . Variable naming rule : 1, Be descriptive : 2, Variable names can only be   Underline , Numbers , Alphabetic composition , No special symbols or spaces : 3, Cannot use Chinese as variable name ( standard ): 4, Cannot start with a number : 5, Reserved characters ( The key word : Such as print ...

  8. VirtualBox Network connection mode

    VirtualBox There are four network access modes under the graphical interface , They are : 1.NAT Network address translation mode (NAT,Network Address Translation) 2.Bridged Adapter The bridge ...

  9. Customize Directive Use ngModel

    We know ngModel yes AngularJS The default one in Directive, Two way binding for data . It's usually used like this : <input type="text" ng-model=&q ...

  10. Java WebService Simple example [ Reprint ]

    [ Be careful , Reprinted from  http://hyan.iteye.com/    ] One . preparation ( Here are the tools for this example ) 1.MyEclipse10.7.1 2.JDK 1.6.0_22 Two . Create server 1 ...