Bug #71891 | GROUP BY performance differs wildly for tautologically equal columns | ||
---|---|---|---|
Submitted: | 28 Feb 2014 20:27 | Modified: | 5 Mar 2014 20:37 |
Reporter: | Doug Cook | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 5.6.15 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[28 Feb 2014 20:27]
Doug Cook
[28 Feb 2014 20:29]
Doug Cook
database dump for example SQL
Attachment: bugrep.sql (application/octet-stream, text), 443.95 KiB.
[5 Mar 2014 20:37]
MySQL Verification Team
Thank you for the bug report. C:\dbs>c:\dbs\5.6\bin\mysql -uroot --port=3560 --prompt="mysql 5.6 > " Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 20 Server version: 5.6.17 Source distribution Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql 5.6 > use x Database changed mysql 5.6 > set sql_mode = ONLY_FULL_GROUP_BY; Query OK, 0 rows affected (0.00 sec) mysql 5.6 > SELECT sql_no_cache T.generation, GEN.name, count(distinct T.tid) from demo_tag AS T JOIN demo_generation AS GEN ON T.generation = GEN.type GROUP BY T.generation; ERROR 1055 (42000): 'x.GEN.name' isn't in GROUP BY mysql 5.6 > SELECT sql_no_cache T.generation, GEN.name, count(distinct T.tid) from demo_tag AS T JOIN demo_generation AS GEN ON T.generation = GEN.type GROUP BY GEN.type; ERROR 1055 (42000): 'x.T.generation' isn't in GROUP BY mysql 5.6 > http://dev.mysql.com/doc/refman/5.6/en/group-by-extensions.html "MySQL extends the use of GROUP BY so that the select list can refer to nonaggregated columns..... this is useful primarily when all values in each nonaggregated column not named in the GROUP BY are the same for each group. The server is free to choose any value from each group, so unless they are the same, the values chosen are indeterminate. ......"