set GLOBAL query_cache_size=1355776; flush status; create table t1 (a int, b int); create view v1 (c,d) as select sql_no_cache a,b from t1; create view v2 (c,d) as select a+rand(),b from t1; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 0 show status like "Qcache_hits"; Variable_name Value Qcache_hits 0 select * from v1; c d select * from v2; c d show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 0 show status like "Qcache_hits"; Variable_name Value Qcache_hits 0 select * from v1; c d select * from v2; c d show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 0 show status like "Qcache_hits"; Variable_name Value Qcache_hits 0 drop view v1,v2; set query_cache_type=demand; flush status; create view v1 (c,d) as select sql_cache a,b from t1; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 0 show status like "Qcache_hits"; Variable_name Value Qcache_hits 0 select * from v1; c d show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 0 select * from t1; a b show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 0 select * from v1; c d show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 1 select * from t1; a b show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 1 drop view v1; set query_cache_type=default; drop table t1; set GLOBAL query_cache_size=default;