当前位置:网站首页>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.
边栏推荐
猜你喜欢
随机推荐
[Excel知识技能] 将文本型数字转换为数值格式
【ORACLE】什么时候ROWNUM等于0和ROWNUM小于0,两个条件不等价?
“蔚来杯“2022牛客暑期多校训练营2 DGHJKL题解
基于Web的疫情隔离区订餐系统
Cache knowledge summary
ROS Experiment Notes - Validation of UZH-FPV Dataset
Which translation software is more accurate [Free]
Qt入门(六)——抽奖系统的实现
Deep Learning Transformer Architecture Analysis
14. Thymeleaf
如何便捷获取参考文献的引用格式?
Geogebra 教程之 03 没有铅笔的数学
盘点美军的无人机家底
[C language] Implementation of guessing number game
[21天学习挑战赛——内核笔记](五)——devmem读写寄存器调试
缓存知识总结
鲲鹏编译调试及原生开发工具基础知识
【C语言】猜数字游戏的实现
【C语言】数据储存详解
13. 内容协商
![[Excel知识技能] 将数值格式数字转换为文本格式](/img/fb/79d6928456f090d47f0fe7a5074979.png)








