当前位置:网站首页>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.
边栏推荐
猜你喜欢
随机推荐
CF1427F-Boring Card Game【贪心】
Kubernetes 维护技术分享
proxy代理服务_2
UOJ#749-[UNR #6]稳健型选手【贪心,分治,主席树】
Talking about cors
镜头之滤光片---关于日夜两用双通滤光片
基于SSM实现手机销售商城系统
Geogebra 教程之 03 没有铅笔的数学
Is there a way out in the testing industry if it is purely business testing?
22年全国程序员1月薪资出炉,才知道年薪 40 万以上的有这么多?
基于Web的疫情隔离区订餐系统
15. Interceptor - HandlerInterceptor
Google Chrome73~81版本浏览器的跨域问题解决方案
C language, operators of shift operators (> >, < <) explanation
“蔚来杯“2022牛客暑期多校训练营2 DGHJKL题解
闭包详解,柯里化的含义及操作方法
sqlmap combined with dnslog fast injection
What is the ASIO4ALL
16. 文件上传
[数据可视化] 图表设计原则