MySQL - force not to use cache for testing speed of query(MySQL - 强制不使用缓存来测试查询速度)
问题描述
我正在测试 MySQL 中某些查询的速度.数据库正在缓存这些查询,这让我在测试这些查询的速度时很难获得可靠的结果.
I'm testing the speed of some queries in MySQL. The database is caching these queries making it difficult for me to get reliable results when testing how fast these queries are.
有没有办法禁用查询的缓存?
Is there a way to disable caching for a query?
系统:Linux 虚拟主机上的 MySQL 4,我可以访问 PHPMyAdmin.
System: MySQL 4 on Linux webhosting, I have access to PHPMyAdmin.
谢谢
推荐答案
尝试使用 SQL_NO_CACHE (MySQL 5.7) 选项.(MySQL 5.6 用户点击这里)
Try using the SQL_NO_CACHE (MySQL 5.7) option in your query. (MySQL 5.6 users click HERE )
例如
SELECT SQL_NO_CACHE * FROM TABLE
这将停止 MySQL 缓存结果,但请注意其他操作系统和磁盘缓存也可能影响性能.这些更难解决.
This will stop MySQL caching the results, however be aware that other OS and disk caches may also impact performance. These are harder to get around.
这篇关于MySQL - 强制不使用缓存来测试查询速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL - 强制不使用缓存来测试查询速度
基础教程推荐
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 在多列上分布任意行 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- oracle区分大小写的原因? 2021-01-01
