Mysql, Maria DB

CentOS mariadb slow query (슬로우쿼리) 설정

Pydole 2019. 7. 5. 19:29

 

 

slow query는 기본적으로 OFF로 되어 있으며, 10초로 세팅되어 있다.

 

 

 

> show variables like 'slow_query_%' 

 

 

 

 

> show global variables like 'long_query_time%';

 

 

 

> set global slow_query_log = 'ON';

> set global slow_query_log_file ='/var/log/mariadb/slow-query.log';

> set global long_query_time = 5

> flush logs;

 

 

 

 

재기동해도 설정을 유지하려면 아래와 같이 /etc/my.cnf.d/server.cnf에 [mysqld] 안에 세팅해준다