当前位置:网站首页>Mysql. Slow Sql
Mysql. Slow Sql
2022-08-11 00:02:00 【Wandering about the cat】
Configure to enable logging
windows is my.ini file
linux and MacOs is my.cnf file
Enable slow query log
version 5.5 and above
slow_query_log=1
slow-query-log-file=/www/server/data/mysql-slow.log
long_query_time=1
Command ON
set global slow_query_log=1;
Invalid after restart, it is best to put it in the configuration file.
Turn on validation
SHOW VARIABLES LIKE '%slow_query_log%';
Slow query judgment time
SHOW VARIABLES LIKE 'long_query_time%';
Can be reset, this setting will be invalid after Mysql restarts.
set global long_query_time=3;
Check how many times the slow query occurs
show global status like '%Slow_queries%';
Test Validation
select sleep(11);
Log position
Slow Sql log:
Analyze slow query logs
Analyze the slow query log directly,
mysql uses the explain + sql statement to simulate the optimizer to perform the analysis.
oracle uses the explain plan for +sql statement to simulate the optimizer to perform the analysis.
边栏推荐
- SQL注入基础
- C语言%(%d,%c...)
- 【C语言篇】表达式求值(隐式类型转换,算术转换)
- Microsoft: Into Focus with Scott Guthrie Scott Hanselman Rajesh Jha and Kevin Scott | KEY11
- proxy代理服务_2
- How to determine how many bases a number is?
- ROS实验笔记之——UZH-FPV数据集的验证
- 【C语言】数据储存详解
- 13. Content Negotiation
- How to recover deleted files from the recycle bin, two methods of recovering files from the recycle bin
猜你喜欢
随机推荐
逮到一个阿里 10 年老 测试开发,聊过之后收益良多...
【C语言】猜数字游戏的实现
9. Rest 风格请求处理
10. Notes on receiving parameters
N1BOOK writeup
Google Chrome73~81版本浏览器的跨域问题解决方案
Geogebra 教程之 01 什么是Geogebra,真的可以提高我们数学水平么?
Dump文件生成,内容,以及分析
2. 依赖管理和自动配置
花环灯问题
5. Lombok
Jvm.分析工具(jconsole,jvisualvm,arthas,jprofiler,mat)
回收站的文件删了怎么恢复,回收站文件恢复的两种方法
IEEE的论文哪里可以下载?
如何利用原生JS实现回到顶部以及吸顶效果
11. 自定义转换器
CF1534F2-Falling Sand (Hard Version)
[C language] First understanding of pointers
Doris建表注意事项,实时数仓的同学记得收藏
There is no recycle bin for deleted files on the computer desktop, what should I do if the deleted files on the desktop cannot be found in the recycle bin?