Can MySQL use index in a RANGE QUERY with ORDER BY?
问题 I have a MySQL table: CREATE TABLE mytable ( id INT NOT NULL AUTO_INCREMENT, other_id INT NOT NULL, expiration_datetime DATETIME, score INT, PRIMARY KEY (id) ) I need to run query in the form of: SELECT * FROM mytable WHERE other_id=1 AND expiration_datetime > NOW() ORDER BY score LIMIT 10 If I add this index to mytable: CREATE INDEX order_by_index ON mytable ( other_id, expiration_datetime, score); Would MySQL be able to use the entire order_by_index in the query above? It seems like it