Home  >  Article  >  Database  >  清空mysql 查询缓存的可行方法

清空mysql 查询缓存的可行方法

WBOY
WBOYOriginal
2016-06-07 16:29:01935browse

对一条sql进行优化时,发现原本很慢的一条sql(将近1分钟) 在第二次运行时, 瞬间就完成了(0.00sec) 这是因为mysql对同一条sql进行了缓存,服务器直接从上次的查询结果缓存中读取数据,而不是重新分析、执行sql。 可通过如下方法清空查询缓存 reset query

对一条sql进行优化时,发现原本很慢的一条sql(将近1分钟) 在第二次运行时, 瞬间就完成了(0.00sec)

这是因为mysql对同一条sql进行了缓存,服务器直接从上次的查询结果缓存中读取数据,而不是重新分析、执行sql。

可通过如下方法清空查询缓存

reset query cache;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn