当前位置:网站首页>isn't it?Is there anyone who can't locate the slow query problem of MySQL online?
isn't it?Is there anyone who can't locate the slow query problem of MySQL online?
2022-08-05 11:47:00 【InfoQ】
1. The role of the slow query log
2. Configuration of slow query log
2.1 Check whether slow query log is enabled
show variables like 'slow_query_log';

2.2 Open slow query log
set global slow_query_log=1;

2.3Setting the threshold for slow query logs

set long_query_time=1;

2.4 Modifying the slow query log location
show variables like '%slow_query_log_file%';

2.5 Record more slow query SQL

set global log_slow_admin_statements=ON;


set global log_queries_not_using_indexes=ON;

3. Use of slow query log
select * from user;
cat /usr/local/mysql/data/localhost_slow.log

4. Analyze slow query logs
Common parameters are
-s: Indicates which way to sort:
c: number of visits
l: lock time
r:Return records
t: query time
al: average lock time
ar: average number of returned records
at: average query time
-t: how many previous records are returnedData;
4.1 The 10 SQL with the most returned results:

4.2 The 10 longest SQL queries:

边栏推荐
- todolist案列——原生js
- Security Issues and Prevention in Web3
- 四、kubeadm单master
- EOS的共识机制与区块生成
- Letter from Silicon Valley: Act fast, Facebook, Quora and other successful "artifacts"!
- The principle and application scenario of mysql master-slave synchronization
- hdu1455 Sticks(搜索+剪枝+剪枝+.....+剪枝)
- Student Information Management System (first time...)
- 小红的aba子序列(离散化、二分、dp维护区间最短)
- el-menu箭头改为右下
猜你喜欢

力扣330 按要求补齐数组(贪心)

Http-Sumggling Cache Vulnerability Analysis

Letter from Silicon Valley: Act fast, Facebook, Quora and other successful "artifacts"!
字节秋招二面把我干懵了,问我SYN报文什么情况下会被丢弃?

四、kubeadm单master

Go compilation principle series 9 (function inlining)

互联网行业凛冬之至,BATM的程序员是如何应对中年危机的?

基于NSQ搭建高可用分布式消息队列

The training set Loss converges, but the test set Loss oscillates violently?

623. Add a row to a binary tree: Simple binary tree traversal problems
随机推荐
#yyds干货盘点#JS数组和树相互转化
机器学习——逻辑回归
Support Vector Machine SVM
知乎提问:中国是否还能实现伟大民族复兴
LeetCode brush questions (8)
Go compilation principle series 9 (function inlining)
Exploration and practice of transaction link under multi-service mode
hello world、hello 计科人
丹尼尔·拉瑞莫(BM):EOS的主要开发者
安全软件Avast与赛门铁克诺顿NortonLifeLock合并获英国批准
解决 cuDNN launch failure 错误
“蘑菇书”是怎样磨出来的?
再获殊荣 | 赛宁网安入选2022年度“培育独角兽”企业榜单
互联网行业凛冬之至,BATM的程序员是如何应对中年危机的?
How to write a blog with Golang - Milu.blog development summary
朴素贝叶斯
Five reasons why developers choose Klocwork, a static analysis tool for code quality, for software security
ansible-playbook配置ssh互信
The training set Loss converges, but the test set Loss oscillates violently?
2-2.基金的投资交易与结算