For example, if a table has columns A, B, ID, and (ID) is the primary key, and (A) is a secondary index.
I wonder if the leaf nodes on the secondary index (A) is sorted by (A,ID), or just (A), and the order of ID is not required?
The question comes from the reading of High Performance MySQL,3rd Edition, in which the author says
... Recall that in InnoDB, an index on column (A) in our example table is really equivalent to an index on (A, ID) because the primary key is appended to secondary index leaf nodes. If you have a query such as WHERE A = 5 ORDER BY ID, the index will be very helpful...
I don't understand why by using (A) we can speed up the query of a ORDER BY ID. This can be true only when in the secondary index (A), leaf nodes are not only sorted by A but also sorted by ID.