当前位置:网站首页>MySQL and PostgreSQL methods to grab slow SQL
MySQL and PostgreSQL methods to grab slow SQL
2022-07-02 12:13:00 【alwaysonline819】
List of articles
1. MySQL Medium crawl slow SQL
- Check the related configuration of slow query
show variables like '%quer%';

- slow_query_log: Indicates whether to turn on the slow query log
- slow_query_log_file: Specify which log file the slow query log is stored in
- long_query_time: Indicates how long the query is recognized as " The slow query ". The default value is :10s
- log_queries_not_using_indexes: Indicates if it runs sql Indexes are not used , Whether it is also recorded in the slow query log as a slow query statement .
- log_throttle_queries_not_using_indexes: When log_queries_not_using_indexes Set to on when , This parameter limits the number of times a query statement that does not use an index is recorded in the slow query log per minute .
- Temporarily open / Turn off slow query log
set global slow_query_log = on
set global slow_query_log = off
- View slow query log
(1) Just started using slow queries ,vi or cat The command can still be used , You can also find , But as the number of logs grows , You may not be able to query , At this time, you need to use 2
(2)MySQL Built in mysqldumpslow Command analysis ( The specific use method can be Baidu )
2. PostgreSQL Grab slow SQL
- View the current slow query configuration
show log_min_duration_statement;
- stay postgresql.conf Configure global slow query log in ( millisecond )
log_min_duration_statement=10000;
- Slow query log location storage
log_destination = 'csvlog' # After opening this , below log_filename designated log The suffix file will have no content , All in csv In file
logging_collector = on
log_directory = 'pg_log' # In the current directory pg_log Folder
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
- Reload configuration
select pg_reload_conf();
- test
begin TRANSACTION;
select pg_sleep(5);
select now() ;
END TRANSACTION;
- see csv file , Filter duration Field
边栏推荐
- drools动态增加、修改、删除规则
- Leetcode739 每日温度
- Leetcode209 长度最小的子数组
- 小程序链接生成
- 机械臂速成小指南(七):机械臂位姿的描述方法
- Read the Flink source code and join Alibaba cloud Flink group..
- LeetCode—剑指 Offer 37、38
- Depth filter of SvO2 series
- CDA data analysis -- Introduction and use of aarrr growth model
- This article takes you to understand the operation of vim
猜你喜欢
![[QT] Qt development environment installation (QT version 5.14.2 | QT download | QT installation)](/img/18/f0c9ef6250a717f8e66c95da4de08c.jpg)
[QT] Qt development environment installation (QT version 5.14.2 | QT download | QT installation)

(C language) input a line of characters and count the number of English letters, spaces, numbers and other characters.

Yygh-9-make an appointment to place an order

PyTorch nn.RNN 参数全解析

Small guide for rapid formation of manipulator (VII): description method of position and posture of manipulator

排序---

Docker-compose配置Mysql,Redis,MongoDB

conda常用命令汇总

自然语言处理系列(一)——RNN基础

基于Arduino和ESP8266的Blink代码运行成功(包含错误分析)
随机推荐
Log4j2
How does Premiere (PR) import the preset mogrt template?
使用Sqoop把ADS层数据导出到MySQL
JZ63 股票的最大利润
(C语言)八进制转换十进制
AI中台技术调研
MySQL与PostgreSQL抓取慢sql的方法
Those logs in MySQL
Initial JDBC programming
Addition, deletion, modification and query of MySQL table (Advanced)
深入理解P-R曲线、ROC与AUC
Jenkins user rights management
输入一个三位的数字,输出它的个位数,十位数、百位数。
lombok常用注解
Docker-compose配置Mysql,Redis,MongoDB
Leetcode122 the best time to buy and sell stocks II
Deep understanding of NN in pytorch Embedding
初始JDBC 编程
Differences between nodes and sharding in ES cluster
上传文件时,服务器报错:IOFileUploadException: Processing of multipart/form-data request failed. 设备上没有空间