当前位置:网站首页>MySQL slow query
MySQL slow query
2022-04-23 05:00:00 【Promote wine】
One . Slow query Introduction
MySQL The slow query log of is MySQL A type of logging provided , It is used to record in MySQL The response time in exceeds the specified threshold SQL sentence , Running time exceeds long_query_time It's worth it SQL, Will be recorded in the slow query log .
By default ,MySQL The database does not start the slow query log , Manual opening required . If it's not for tuning , It is generally not recommended to open , Because opening slow query log will bring some performance impact more or less .
stay SQL Server We use SQL Profile To record SQL The implementation of , stay Oracle We can use AWR、ASH Report to analyze history SQL The implementation of , A similar tuning approach maps to MySQL in , This corresponds to the slow query log .
Two . Parameter Introduction
slow_query_log: Open slow query log or not ,1 Open for indication ,0 Means closing .
slow_query_log_file:MySQL Slow query log storage path .
long_query_time : Slow query threshold (s), When the query time is longer than the set threshold , Log .
log_queries_not_using_indexes: Queries that are not indexed are also recorded in the slow query log .
log_throttle_queries_not_using_indexes: Indicates that... Is allowed to be recorded every minute slow_log Not indexed sql Number of statements (0 For unlimited , If it is a fixed value , It may not be recorded sql).
log_output: How to store logs .’FILE’ Means to save to a file ,‘TABLE’ Indicates that it is stored in the system table . because FILE The mode overhead is relatively low , So the default is FILE.
log_slow_admin_statements = 1: Record ALTER TABLE And so on
log_slow_slave_statements = 1: Record slow queries generated from the server
min_examined_row_limit = 100 :SQL The number of scanning lines is greater than or equal to 100 Lines will be recorded
Open slow query log or not
show variables like '%slow_query_log%';

Slow query threshold (s), When the query time is longer than the set threshold , Log
show variables like '%long_query_time%';

3、 ... and . Open slow query log
-- Slow query threshold (s), When the query time is longer than the set threshold , Log .
set global long_query_time = 2;
-- Queries that are not indexed are also recorded in the slow query log
set global log_queries_not_using_indexes = 1;
-- Indicates that... Is allowed to be recorded every minute slow_log Not indexed sql Number of statements (0 For unlimited , If it is a fixed value , It may not be recorded sql).
set global log_throttle_queries_not_using_indexes = 0;
-- QL The number of scanning lines is greater than or equal to 100 Lines will be recorded
set global min_examined_row_limit = 100;
-- Turn on
set global slow_query_log = 1;
版权声明
本文为[Promote wine]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230457444723.html
边栏推荐
- Use AES encryption - reuse the wisdom of predecessors
- QPushbutton 槽函数被多次触发
- [2021] Spatio-Temporal Graph Contrastive Learning
- Detailed explanation of the differences between TCP and UDP
- Wechat payment function
- JS determines whether the numeric string contains characters
- SCP command details
- selenium模式下切换窗口,抓取数据的实现
- List< Map> Replication: light copy and deep copy
- 信息学奥赛一本通 1212:LETTERS | OpenJudge 2.5 156:LETTERS
猜你喜欢

Opencv + clion face recognition + face model training
![[WinUI3]編寫一個仿Explorer文件管理器](/img/3e/62794f1939da7f36f7a4e9dbf0aa7a.png)
[WinUI3]編寫一個仿Explorer文件管理器

【数据库】MySQL多表查询(一)

2022/4/22

Wine (COM) - basic concept

#define 定义常量和宏,指针和结构体
![[2021] Spatio-Temporal Graph Contrastive Learning](/img/7d/67a0bfa0adecee24bbe291a25ae906.png)
[2021] Spatio-Temporal Graph Contrastive Learning
![[database] MySQL multi table query (I)](/img/c7/43167aa6169c24a8d9734032775335.png)
[database] MySQL multi table query (I)

Repair of self calibration SPC failure of Tektronix oscilloscope dpo3054

持续集成(CI)/持续交付(CD)如何彻底改变自动化测试
随机推荐
List remove an element
MySQL - index
redis和mysql区别
Innovation training (10)
Use the built-in function of win to transfer files between two computers in the same LAN (the speed is the same as that between local disks)
Better way to read configuration files than properties
The unity camera rotates with the mouse
What's the difference between error and exception
Knowledge points sorting: ES6
JS generates a specified number of characters according to some words
[WinUI3]編寫一個仿Explorer文件管理器
JS engine loop mechanism: synchronous, asynchronous, event loop
Learning Android from scratch -- baseactivity and activitycollector
Introduction to load balancing
[2021] Spatio-Temporal Graph Contrastive Learning
QPushbutton 槽函数被多次触发
Independent station operation | Facebook marketing artifact - chat robot manychat
2022/4/22
Details related to fingerprint payment
静态流水线和动态流水线的区别认识