mysql5.5.25 源码阅读---query cache


SQL_CACHE
   先从query cache 查找,
   若有直接返回query cache 中结果
   若没有再进行select,并且将结果放在query cache中(前提是满足放入query cache条件)
  
SQL_NO_CACHE
   不检查query cache,直接进行查询
       sql_cache.cc
       Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
         if (query_length > 20 && has_no_cache_directive(&sql[i+6]))
         {
            DBUG_PRINT("qcache", ("The statement has a SQL_NO_CACHE directive"));
            goto err;
         }
   不把结果放在query cache中


相关命令
flush query cache :整理query cache碎片,并不会移除query cache内容
reset query cache / FLUSH TABLES :清空query cache内容


猜你喜欢

转载自babaoqi.iteye.com/blog/1751599