This is too long for a comment.
You are saying that the query:
select *
from t
order by id
is not ordering the table by id
. If so, this would indicate a bug in MySQL, which is unlikely.
Some thoughts:
(1) Perhaps you are doing this in a subquery. The ordering is not guaranteed when done in a subquery.
(2) Perhaps you are expecting an ordering on id
to order by the elements of the composite index. That would be an incorrect expectation. Order by the things you want to order on.
(3) Perhaps id is being stored as a character string, but contains only digits. If so, then '10'
will come before '9'
.
Can you show what query you are using and the results that you are getting?