mysql order by optimization-turn

https://www.cnblogs.com/songwenjie/p/9418397.html

 

to sum up:

The WHERE condition and ORDER BY use the same index, and the order of the ORDER BY is the same as the index order (the index used by where), and the fields of the ORDER BY are in ascending or descending order, and the query field is only the sorted index field . Otherwise, an additional sorting operation is definitely needed, and Filesort will appear.

Guess you like

Origin blog.csdn.net/qq_24271537/article/details/114148300