当前位置:网站首页>Mysql.慢Sql
Mysql.慢Sql
2022-08-10 23:47:00 【闲猫】
配置开启日志记录
windows中是 my.ini 文件
linux和MacOs中是 my.cnf 文件
开启慢查询日志
5.5以上版本
slow_query_log=1
slow-query-log-file=/www/server/data/mysql-slow.log
long_query_time=1
命令开启
set global slow_query_log=1;
重启后失效,最好放在配置文件中。
开启验证
SHOW VARIABLES LIKE '%slow_query_log%';
慢查询判定时间
SHOW VARIABLES LIKE 'long_query_time%';
可重新设置,这种设置Mysql重启后就失效了。
set global long_query_time=3;
查看慢查询出现了多少次
show global status like '%Slow_queries%';
测试验证
select sleep(11);
日志位置
慢Sql日志:
分析慢查询日志
直接分析慢查询日志,
mysql使用explain + sql语句进行模拟优化器来执行分析。
oracle使用explain plan for + sql语句进行模拟优化器来执行分析。
边栏推荐
- proxy代理服务_2
- C language, operators of shift operators (> >, < <) explanation
- [C language] Implementation of guessing number game
- 11. Custom Converter
- 多语种翻译-多语种翻译软件免费
- 线程相关知识点
- The Missing Semester of Your CS Education
- 9. Rest 风格请求处理
- [21天学习挑战赛——内核笔记](五)——devmem读写寄存器调试
- Design and implementation of flower online sales management system
猜你喜欢
随机推荐
阿里P7晒出1月工资单:狠补了这个,真香...
Web-based meal ordering system in epidemic quarantine area
推进牛仔服装的高质量发展
Rust从入门到精通05-语句和表达式
call,apply,bind指定函数的this指向详解,功能细节,严格和非严格模式下设定this指向
鲲鹏编译调试及原生开发工具基础知识
软件测试证书(1)—— 软件评测师
6.0深入理解MySQL事务隔离级别与锁机制
VR全景+安全科普教育,让学生们提高安全意识
CDN原理与应用简要介绍
Special class and type conversion
10. Notes on receiving parameters
Qt入门(六)——抽奖系统的实现
How to recover deleted files from the recycle bin, two methods of recovering files from the recycle bin
花环灯问题
The Missing Semester of Your CS Education
9. Rest 风格请求处理
13. 内容协商
CSDN21天学习挑战赛之折半插入排序
sqlmap combined with dnslog fast injection