当前位置:网站首页>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.
边栏推荐
- 11. 自定义转换器
- 10. Notes on receiving parameters
- 电脑桌面删除的文件回收站没有,电脑上桌面删除文件在回收站找不到怎么办
- 【C语言篇】操作符之 位运算符详解(“ << ”,“ >> ”,“ & ”,“ | ”,“ ^ ”,“ ~ ”)
- SQL injection base - order by injection, limit, wide byte
- 7. yaml
- [C language articles] Expression evaluation (implicit type conversion, arithmetic conversion)
- Timers, synchronous and asynchronous APIs, file system modules, file streams
- proxy代理服务_2
- [Excel知识技能] 将数值格式数字转换为文本格式
猜你喜欢
随机推荐
CF1534F2-Falling Sand (Hard Version)
11. 自定义转换器
Promise in detail
String
Design and Realization of Employment Management System in Colleges and Universities
Easy-to-use translation plug-in - one-click automatic translation plug-in software
翻译软件哪个准确度高【免费】
8. WEB 开发-静态资源访问
11. Custom Converter
图像识别和语义分割的区别
一条SQL查询语句是如何执行的?
C语言篇,操作符之 移位运算符(>>、<<)详解
缓存知识总结
工程师如何对待开源
Jvm.分析工具(jconsole,jvisualvm,arthas,jprofiler,mat)
Dump文件生成,内容,以及分析
16. File upload
开源一夏|OpenHarmony如何选择图片在Image组件上显示(eTS)
sqlmap结合dnslog快速注入
App regression testing, what are the efficient testing methods?