Experiment:
Type:range The range index is used here
Key_len:12/3=4Column
The indexes c1, c2, c3, c4 are used. Analysis : Because order by c3 is ordered, c3 and c4 also use the index
The above picture uses c1, c2, c3, order by order, you can use the index.
The above picture only uses index c1, because order by c3, the order of c2 is different from the index order
The above picture c1, c2, c3
The above picture c1, c2, c3 because When sorting, c2 is a constant
Only c1 is used in the above picture
To count the average price by column (group by)
Generally speaking, grouping must first be sorted by the grouping field, Arrangement, using temporary table sorting.
The above introduces the Mysql database optimization series (5)------Interview questions on index optimization strategies, including relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.