Bug #30368 | GROUP BY primary_key query's output is not ordered when the PK is not ordered | ||
---|---|---|---|
Submitted: | 11 Aug 2007 2:26 | Modified: | 29 Aug 2007 14:54 |
Reporter: | Sergey Petrunya | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.1/5.0/5.1 | OS: | Any |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[11 Aug 2007 2:26]
Sergey Petrunya
[11 Aug 2007 4:10]
MySQL Verification Team
Thank you for the bug report. Verified as described.
[17 Aug 2007 15:12]
Roland Bouman
If you ask me, we should get rid of the behaviour of always returning results ordered according to the GROUP BY clause. An ordered result is nice if you need it, but I don't see why GROUP BY must claim to always do it, esp. as it costs performance. Carelessly writing a GROUP BY (reporting tools do sometimes) result in costly queries, and for no reason at all. It would be much better if the user could turn the behaviour off with an sql_mode or similar. (http://bugs.mysql.com/bug.php?id=30477)
[25 Aug 2007 20:12]
Sergey Petrunya
Roland, I side with PeterZ's position expressed in BUG#30477. However, in the "GROUP BY requires ordering" mode the output must be ordered no matter if there are some unique indexes or not.
[29 Aug 2007 14:54]
Sergey Petrunya
Fixed by fix for BUG#30596.