The process of grouping entities into collections of associated elements.
Sorting is the process of applying some order to a collection of items.
Application simpler fields
"Instead knowing that we want to grouping by these columns we can make the application code to do so simpler by sorting by these fields"
from question "Build mongoDB queries based on JSON from a user using Python"
"This way only a single int column needs to be sorted grouping which performs much better than sorting two text columns"
from question "How to solve performance GROUP BY issue in MySQL?"
"The reason being that sorting less elements which the grouping generally produces is going to be faster than sorting all input documents"
from question "Is it possible to sort, group and limit efficiently in Mongo with a pipeline?"
"Grouping has looser constraints than sorting so in theory it could be marginally faster than sorting but unless you re dealing with a lot of data you re unlikely to see a speed difference"
from question "Efficiently emulate SQL's group by clause in a programming language like Java or C++ instead of resorting to an RDBMS"
"Your desired output does not reflect what you have as input if you want to grouping common sublists you can use itertools.groupby considering you want sorted output using a dict and then sorting makes less sense than just creating the grouping from the sorted list using groupby"
from question "Finding and grouping same values, (float vectors) in nested lists"
"If the database is sophisticated enough adding an explicit order by clause will hint that sorting is more optimal for the grouping operation as well as the sorting can then be re-used in the query execution pipeline"
from question "Does ms access group by order the results?"
|More efficient way||
"Of course ordering could be forced obj.gettype .tostring and using lexical order but since a strict order is not necessary only grouping i was wondering if there s a more efficient way than sorting"
from question "Grouping elements of a list efficiently"