I want to select the contents of a text column from entrytable .
EXPLAIN SELECT text FROM entrytable WHERE user = 'username' && `status` = '1' && ( `status_spam_user` = 'no_spam' || ( `status_spam_user` = 'neutral' && `status_spam_system` = 'neutral' ) ) ORDER BY datum DESC LIMIT 6430 , 10
The table has three indexes:
- index_user (user)
- index_datum (datum)
- index_status_mit_spam (status, status_spam_user, status_spam_system)
EXPLAIN result:
id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE entrytable ref index_user,index_status_mit_spam index_user 32 const 7800 Using where; Using filesort
- Are
possible_keys MySQL indexes that you might want to use, and keys MySQL indexes actually use? - Why is
index_status_mit_spam not used? The columns in the query are in the same order as in the index, ... - Why is
index_datum not used for ORDER BY ? - How can I optimize my index tables or query? (The query above takes up to 3 seconds, having about a million entries in the table).
source share