I have trouble ordering two columns.
EXPLAIN SELECT * FROM articles WHERE option <>0 AND deleted=0 ORDER BY
date_added DESC, category_id DESC LIMIT 25 OFFSET 500
id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE articles ALL NULL NULL NULL NULL 437168 Using where; Using filesort
I add single indexes for (option, deleted, date_added, category_id)
When i used:
EXPLAIN SELECT * FROM articles WHERE option <>0 AND deleted=0 ORDER BY
date_added DESC LIMIT 25 OFFSET 500
or
EXPLAIN SELECT * FROM articles WHERE option <>0 AND deleted=0 ORDER BY
category_id DESC LIMIT 25 OFFSET 500
Using only where
I tried add index to (option, deleted, date_added, category_id) but it works only when i try sort by one column.