2

For some reason, the Maria DB (version 10.1) slow query log is not writing anything. I've enabled slow query logging:

select @@slow_query_log, @@slow_query_log_file, @@long_query_time, @@log_output;

| 1 | /var/log/mysql/mariadb-slow.log | 3.000000 | FILE |

I can trigger a slow query and see that it is being noted:

select sleep(5);
show status like 'Slow_queries%';

| Slow_queries | 1 |

But when I check the slow query log in /var/log/mysql/mariadb-slow.log, it is empty.

  • sleep() does not increment slow_queries. Run an actual slow query to see something logged. – Michael Hampton Dec 30 '18 at 21:44
  • Are you sure? Other resources have specified that's the way to test the slow query log: https://dba.stackexchange.com/questions/7777/write-a-slow-query-to-test-slow-query-logging. It's definitely affecting the slow_queries status. – rich remer Dec 30 '18 at 21:53
  • I just tried it for myself on an actual running MariaDB 10.2.20 database before posting the comment. Maybe it worked in 2011, but it isn't today. – Michael Hampton Dec 30 '18 at 21:55
  • When you say you tried it, do you mean it's NOT updating Slow_queries? Or just that it does not write to the log file? – rich remer Dec 30 '18 at 21:56
  • I mean that slow_queries does not change. And of course nothing is written to the log. – Michael Hampton Dec 30 '18 at 21:56
  • OK, then this seems to be a difference between Maria DB 10.1 and 10.2. It's most definitely updating the Slow_queries on 10.1. – rich remer Dec 30 '18 at 21:57
  • I would guess it's not meant to. It's rather pointless to log a sleep() as a slow query, after all. – Michael Hampton Dec 30 '18 at 21:58
  • Do things work if you change log_output to TABLE? – Rick James Jan 02 '19 at 04:55

0 Answers0