Slow queries
The slow query log feature gives the possibility to log queries that take more than x seconds to be executed. This is the first step when investigating a performance issue. To look at the current status, connect to your MariaDB instance and launch it:
MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE '%SLOW_QUERY%'; +---------------------+---------------------------------+ | Variable_name | Value | +---------------------+---------------------------------+ | slow_query_log | OFF | | slow_query_log_file | /var/log/mysql/mariadb-slow.log | +---------------------+---------------------------------+ 2 rows in set (0.00 sec)
Here, we can see the path of the slow query logs. To activate this on the fly, run that SQL command:
MariaDB [(none)]> SET GLOBAL SLOW_QUERY_LOG=1; Query OK, 0 rows affected (0.00 sec)
The other option is to set in seconds the query delay to mark it as a long query. These long queries will be logged...