In my.cnf, I have the following settings:
log-queries-not-using-indexes
slow_query_log_file=/tmp/mysqld.slow.log
slow_query_log=1
long_query_time=1
log-error=/tmp/mysqld.error.log
Immediately I had several of these queries show up in mysqld.slow.log:
# Query_time: 0.000283 Lock_time: 0.000063 Rows_sent: 0 Rows_examined: 0
SET timestamp=1453001358;
SELECT options, 'var1' FROM tableA WHERE id=2049020229
UNION
SELECT options, 'var2' FROM tableB WHERE id=2049020229;
(breaks added for legibility)
EXPLAIN gives me 3 rows of data. The first two show that the PRIMARY key is used, and the third (UNION RESULT) shows NULL under both "possible keys" and keys".
So I'm confused. Am I correct that the query is correctly using the indexes? And that the query time was less than 5 seconds (0.000283 seconds)? If so, why is it showing up in the slow log?