set global query_cache_size=100000; flush status; create table t1(c1 int); insert into t1 values(1),(10),(100); prepare stmt1 from "select * from t1 where c1=10"; show status like 'Qcache_hits'; Variable_name Value Qcache_hits 0 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 0 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 1 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 2 prepare stmt2 from "select * from t1 where c1=10"; execute stmt2; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 3 execute stmt2; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 4 execute stmt2; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 5 prepare stmt3 from "select * from t1 where c1=10"; execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 6 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 7 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 8 select * from t1 where c1=10; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 9 flush tables; execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 9 select * from t1 where c1=10; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 10 prepare stmt1 from "select * from t1 where c1=?"; show status like 'Qcache_hits'; Variable_name Value Qcache_hits 10 set @a=1; execute stmt1 using @a; c1 1 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 10 set @a=100; execute stmt1 using @a; c1 100 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 10 set @a=10; execute stmt1 using @a; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 10 prepare stmt1 from "select * from t1 where c1=10"; set global query_cache_size=0; show status like 'Qcache_hits'; Variable_name Value Qcache_hits 10 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 10 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 10 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 10 set global query_cache_size=100000; execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 10 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 11 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 12 set global query_cache_size=0; prepare stmt1 from "select * from t1 where c1=10"; set global query_cache_size=100000; show status like 'Qcache_hits'; Variable_name Value Qcache_hits 12 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 12 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 12 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 12 set global query_cache_size=0; prepare stmt1 from "select * from t1 where c1=?"; set global query_cache_size=100000; show status like 'Qcache_hits'; Variable_name Value Qcache_hits 12 set @a=1; execute stmt1 using @a; c1 1 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 12 set @a=100; execute stmt1 using @a; c1 100 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 12 set @a=10; execute stmt1 using @a; c1 10 show status like 'Qcache_hits'; Variable_name Value Qcache_hits 12 drop table t1; set global query_cache_size=0; flush status;