当前位置:网站首页>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.
边栏推荐
- Doris建表注意事项,实时数仓的同学记得收藏
- 闭包详解,柯里化的含义及操作方法
- oai 采样频率计算
- CF1286E-Fedya the Potter Strikes Back【KMP,RMQ】
- promise详解
- How to quickly grasp industry opportunities and introduce new ones more efficiently is an important proposition
- [C language articles] Expression evaluation (implicit type conversion, arithmetic conversion)
- Jvm.分析工具(jconsole,jvisualvm,arthas,jprofiler,mat)
- 【C语言】数据储存详解
- [C language] binary search (half search)
猜你喜欢
随机推荐
12. Handling JSON
[21天学习挑战赛——内核笔记](五)——devmem读写寄存器调试
2022下半年软考「高项」易混淆知识点汇总(2)
u盘数据不小心删除怎么恢复,u盘数据删除如何恢复
逮到一个阿里 10 年老 测试开发,聊过之后收益良多...
线上突然查询变慢怎么核查
后疫情时代,VR全景营销这样玩更加有趣!
5. Lombok
【C语言篇】操作符之 位运算符详解(“ << ”,“ >> ”,“ & ”,“ | ”,“ ^ ”,“ ~ ”)
图片懒加载(纯手写)
Microsoft: Into Focus with Scott Guthrie Scott Hanselman Rajesh Jha and Kevin Scott | KEY11
如何利用原生JS实现回到顶部以及吸顶效果
高校就业管理系统设计与实现
[C language] First understanding of pointers
The Missing Semester of Your CS Education
服务器小常识
[数据可视化] 图表设计原则
Excel English automatic translation into Chinese tutorial
10. Notes on receiving parameters
从0开始设计JVM ,忘记名词跟上思路一次搞懂