5.7.2 Sort grouping
Sort grouping is a grouping method that groups data after sorting the data.
First, a work table is created for each SQL processing real thread. Next, the data in each work table is sorted by the values of the grouping column, and then the sorted data for all SQL processing real threads is collected to create a group.
If an SQL statement containing the DISTINCT set function is executed, sort grouping might be applied to eliminate duplicate retrieval results.
The following figure shows the sort grouping methods.