Hello, I'd like MySQL to use the index to sort these rows.
SELECT
identity_ID
FROM
identity
WHERE
identity_modified > 1257140905
ORDER BY
identity_modified
However, this is using a filesort for sorting (undesirable).
Now, if I leave off the ORDER BY clause here, the rows come out sorted simply as a consequence of using the index to satisfy the WHERE clause.
So, I can get the behaviour I want by leaving off the WHERE clause, but then I'm relying on MySQL's behaviour to be consistent for the rows to arrive in order, and might get stung in future simply if MySQL changes its internal behaviour.
What should I do? Any way of telling MySQL that since the index is stored in order (b-tree) that it doesn't need a filesort for this?
The table looks like this (simplified):
CREATE TABLE IF NOT EXISTS `identity` (
`identity_ID` int(11) NOT NULL auto_increment,
`identity_modified` int(11) NOT NULL,
PRIMARY KEY (`identity_ID`),
KEY `identity_modified` (`identity_modified`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;