We need to support ORDER/GROUP BY in EXPLAIN JSON.
MySQL's way of doing it has some good ideas: ordering_operation and grouping_operation are two different ops that one can see. But it has issues, too:
- ordering_operation is present even when no ordering takes place http://bugs.mysql.com/bug.php?id=74462
- they show "using_temporary_table": true for both duplicates_removal and "ordering_operation" http://bugs.mysql.com/bug.php?id=74661 when execution only uses one temp.table
- they ignore LIMIT.
- ordering_operation is present even when there is no "operation". Is simply using the appropriate index an "ordering operation"?
- duplicate_removal may be shown when no duplicate removal takes place: http://bugs.mysql.com/bug.php?id=74744