From here: http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html
In some cases, MySQL can use an index to satisfy an ORDER BY clause without doing any extra sorting.
I thought indexes helped with retrieving specific pieces of data (like the indexes in array) giving you a O(1) instead of O(n) when indexed. But when sorting, I assumed they use whatever O(nlogn) or something algorithm based on the sorting column, however apparently indexing the columns you sort by can decrease the amount of work involve.
How does this work? ( I am not sure if this is a general SQL thing or a MySQL thing either )
A simple answer: Generally, indexes are themselves stored in sorted order (otherwise, using an index to quickly find a record would be extremely difficult!) Hence, “in some cases” (when an ORDER BY matches the sort order of an index), the data can be returned via its index order, “without doing any extra sorting”.
Further: As @Will A’s answer reminded me, you may wish to learn about covering indexes, which extend this concept.