MariaDB / MySQL

phpMyAdmin show my DB version as: Server version: 10.0.21-MariaDB-log - openSUSE package

I have my slow query log settings as follows:

long_query_time = 0.200000
slow_query_log = 1
slow_query_log_file = /var/log/mysql/queries-slow.log
log_queries_not_using_indexes = 1

For some reason I get queries being logged are not slow enough to need to be logged. E.g. from the log:

> tail -n 100 -f /var/log/mysql/queries-slow.log|grep 'Query_time:'

Query_time: 0.000103 Lock_time: 0.000029 Rows_sent: 3 Rows_examined: 6

Query_time: 0.000441 Lock_time: 0.000083 Rows_sent: 35 Rows_examined: 70

Query_time: 0.000589 Lock_time: 0.000517 Rows_sent: 0 Rows_examined: 0

Query_time: 0.000386 Lock_time: 0.000324 Rows_sent: 0 Rows_examined: 0

Query_time: 0.000227 Lock_time: 0.000204 Rows_sent: 0 Rows_examined: 0

Query_time: 0.000436 Lock_time: 0.000360 Rows_sent: 0 Rows_examined: 0

Query_time: 0.001469 Lock_time: 0.000375 Rows_sent: 0 Rows_examined: 684

Any ideas on why these queries that are clearly quick enough to not be logged, are being logged?

Thanks!

No idea whether this is the answer but the MariaDB documentation says:

The log contains SQL queries that took longer than long_query_time seconds to perform, by default ten seconds, as well as queries that had to examine more than min_examined_row_limit rows. Time to acquire locks is not included in this calculation, only time to resolve the query.

Might be worth looking at min_examined_row_limit.

Good catch, thanks. It defaults to 0 which means you end up logging every query as far as I can tell. Kind of a silly default if you ask me.