我无法订购两列。
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 简单文章 ALL NULL NULL NULL NULL 437168 使用where; 使用文件排序
我为 (option, deleted, date_added, category_id) 添加单个索引
当我使用:
EXPLAIN SELECT * FROM articles WHERE option <>0 AND deleted=0 ORDER BY
date_added DESC LIMIT 25 OFFSET 500
或者
EXPLAIN SELECT * FROM articles WHERE option <>0 AND deleted=0 ORDER BY
category_id DESC LIMIT 25 OFFSET 500
仅在哪里使用
我尝试将索引添加到 (option, deleted, date_added, category_id) 但它仅在我尝试按一列排序时才有效。