📄 query_cache_notembedded.result
字号:
set GLOBAL query_cache_size=1355776;flush query cache;flush query cache;reset query cache;flush status;drop table if exists t1, t2, t3, t11, t21;create table t1 (a int not null);insert into t1 values (1),(2),(3);create table t2 (a int not null);insert into t2 values (1),(2),(3);select * from t1;a123select * from t2;a123insert into t1 values (4);show status like "Qcache_free_blocks";Variable_name ValueQcache_free_blocks 2flush query cache;show status like "Qcache_free_blocks";Variable_name ValueQcache_free_blocks 1drop table t1, t2;create table t1 (a text not null);create table t11 (a text not null);create table t2 (a text not null);create table t21 (a text not null);create table t3 (a text not null);insert into t1 values("1111111111111111111111111111111111111111111111111111");insert into t2 select * from t1;insert into t1 select * from t2;insert into t2 select * from t1;insert into t1 select * from t2;insert into t2 select * from t1;insert into t1 select * from t2;insert into t2 select * from t1;insert into t1 select * from t2;insert into t2 select * from t1;insert into t1 select * from t2;insert into t2 select * from t1;insert into t1 select * from t2;insert into t2 select * from t1;insert into t1 select * from t2;insert into t2 select * from t1;insert into t11 select * from t1;insert into t21 select * from t1;insert into t1 select * from t2;insert into t2 select * from t1;insert into t1 select * from t2;insert into t3 select * from t1;insert into t3 select * from t2;insert into t3 select * from t1;select * from t11;select * from t21;show status like "Qcache_total_blocks";Variable_name ValueQcache_total_blocks 7show status like "Qcache_free_blocks";Variable_name ValueQcache_free_blocks 1insert into t11 values("");select * from t3;show status like "Qcache_total_blocks";Variable_name ValueQcache_total_blocks 8show status like "Qcache_free_blocks";Variable_name ValueQcache_free_blocks 1flush query cache;show status like "Qcache_total_blocks";Variable_name ValueQcache_total_blocks 7show status like "Qcache_free_blocks";Variable_name ValueQcache_free_blocks 1drop table t1, t2, t3, t11, t21;CREATE TABLE t1 ( a INT NOT NULL PRIMARY KEY AUTO_INCREMENT ) ENGINE =MyISAM;LOCK TABLE t1 READ LOCAL;INSERT INTO t1 VALUES (), (), ();SELECT * FROM t1;aSELECT * FROM t1;a123SELECT * FROM t1;adrop table t1;flush query cache;reset query cache;flush status;create table t1 (s1 int)//create procedure f1 () beginselect sql_cache * from t1;select sql_cache * from t1;select sql_cache * from t1;end;//create procedure f2 () beginselect sql_cache * from t1 where s1=1;select sql_cache * from t1;end;//create procedure f3 () beginselect sql_cache * from t1;select sql_cache * from t1 where s1=1;end;//create procedure f4 () beginselect sql_cache * from t1;select sql_cache * from t1 where s1=1;select sql_cache * from t1;select sql_cache * from t1 where s1=1;select sql_cache * from t1 where s1=1;end;//call f1();s1s1s1show status like "Qcache_queries_in_cache";Variable_name ValueQcache_queries_in_cache 3show status like "Qcache_inserts";Variable_name ValueQcache_inserts 3show status like "Qcache_hits";Variable_name ValueQcache_hits 0call f1();s1s1s1show status like "Qcache_queries_in_cache";Variable_name ValueQcache_queries_in_cache 3show status like "Qcache_inserts";Variable_name ValueQcache_inserts 3show status like "Qcache_hits";Variable_name ValueQcache_hits 3call f1();s1s1s1select sql_cache * from t1;s1show status like "Qcache_queries_in_cache";Variable_name ValueQcache_queries_in_cache 4show status like "Qcache_inserts";Variable_name ValueQcache_inserts 4show status like "Qcache_hits";Variable_name ValueQcache_hits 6insert into t1 values (1);select sql_cache * from t1;s11show status like "Qcache_queries_in_cache";Variable_name ValueQcache_queries_in_cache 1show status like "Qcache_inserts";Variable_name ValueQcache_inserts 5show status like "Qcache_hits";Variable_name ValueQcache_hits 6call f1();s11s11s11call f1();s11s11s11select sql_cache * from t1;s11show status like "Qcache_queries_in_cache";Variable_name ValueQcache_queries_in_cache 4show status like "Qcache_inserts";Variable_name ValueQcache_inserts 8show status like "Qcache_hits";Variable_name ValueQcache_hits 10flush query cache;reset query cache;flush status;select sql_cache * from t1;s11select sql_cache * from t1 where s1=1;s11call f1();s11s11s11call f2();s11s11call f3();s11s11call f4();s11s11s11s11s11call f4();s11s11s11s11s11call f3();s11s11call f2();s11s11select sql_cache * from t1 where s1=1;s11insert into t1 values (2);call f1();s112s112s112select sql_cache * from t1 where s1=1;s11select sql_cache * from t1;s112call f1();s112s112s112call f3();s112s11call f3();s112s11call f1();s112s112s112drop procedure f1;drop procedure f2;drop procedure f3;drop procedure f4;drop table t1;reset query cache;drop function if exists f1;create table t1 (id int);create function f1 ()returns intbegindeclare i_var int;set i_var = sleep(3);insert into t1 values(3);set i_var = sleep(3);return 0;end;| select f1();select sleep(4);sleep(4)0select * from t1;id3f1()0select * from t1;id3reset query cache;select * from t1;id3drop table t1;drop function f1;set GLOBAL query_cache_size=0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -