Bug #94433 In mysql 8.0, result set of "group by" query is not sorted
Submitted: 22 Feb 1:15 Modified: 22 Feb 6:59
Reporter: SeWoong Jeon Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:8.0.15 OS:CentOS (CentOS 7.5)
Assigned to: CPU Architecture:x86 (x86_64)
Tags: regression

[22 Feb 1:15] SeWoong Jeon
Description:
In mysql 8.0, result set of "group by" query is not sorted.

mysql> select user, count(*) from mysql.user group by user;
+------------------+----------+
| user             | count(*) |
+------------------+----------+
| sbtest           |        2 | (!!)
| dbtest           |        2 |
| mysql.infoschema |        1 |
| mysql.session    |        1 |
| mysql.sys        |        1 |
| root             |        1 |
+------------------+----------+
6 rows in set (0.00 sec)

How to repeat:
.

Suggested fix:
sort the result set.
[22 Feb 6:44] Umesh Shastry
Hello SeWoong Jeon,

Thank you for the report.

regards,
Umesh
[22 Feb 6:59] Umesh Shastry
My colleague Shane pointed out that this is expected behavior and not a bug. Quoting from our manual - The deprecated ASC or DESC qualifiers for GROUP BY clauses are removed. Queries that previously relied on GROUP BY sorting may produce results that differ from previous MySQL versions. To produce a given sort order, provide an ORDER BY clause.

https://dev.mysql.com/doc/refman/8.0/en/mysql-nutshell.html