본문 바로가기
  • 배움에는 끝이 없다.
Application/SQL (Mysql,MariaDB)

[SQL] MariaDB slow query log 적용 안될 시 확인 방법

by 줘패자 2023. 1. 29.

※ mariadb slow query 를 3초나 5초등으로 적용 했는데도 슬로우쿼리에 모든 쿼리가 전부 쌓이는 증상이 있었다.

 

※ 공식홈페이지 참고

https://mariadb.com/kb/en/library/server-system-variables/#log_queries_not_using_indexes

 

Server System Variables

List of system variables.

mariadb.com

log_queries_not_using_indexes

  • Description: Queries that don't use an index, or that perform a full index scan where the index doesn't limit the number of rows, will be logged to the slow query log (regardless of time taken). The slow query log needs to be enabled for this to have an effect.
  • Commandline: --log-queries-not-using-indexes
  • Scope: Global
  • Dynamic: Yes
  • Data Type: boolean
  • Default Value: OFF

 

위와같은 내용이 있다. 어쩌구 저쩌구 용량 관계없이 쓰여진다 뭐 이런 내용같다.

기본값은 OFF라고 함 

 

MariaDB [(none)]> SHOW VARIABLES LIKE '%log_queries_not_%';    

+-------------------------------+-------+

| Variable_name                 | Value |

+-------------------------------+-------+

| log_queries_not_using_indexes | ON    |

+-------------------------------+-------+

1 row in set (0.00 sec)

 

확인해보니 켜져있다.

MariaDB [(none)]> set global log_queries_not_using_indexes  = OFF;

Query OK, 0 rows affected (0.00 sec)

 

MariaDB [(none)]> SHOW VARIABLES LIKE '%log_queries_not_%';       

+-------------------------------+-------+

| Variable_name                 | Value |

+-------------------------------+-------+

| log_queries_not_using_indexes | OFF   |

+-------------------------------+-------+

1 row in set (0.00 sec)

 

off 한뒤로 정상작동 확인된다.

 

그냥 내가 겪은 사례 중 하나로 크게 도움이 될만한 부분은 아니지만

의외로 간단한 부분에서 삽질하는 경우가 많아서리.. 역시 간단하게 생각하는게 짱이다.

댓글