Bug #42955 | Wrong results returned by join queries with group by/order by when BKA is used | ||
---|---|---|---|
Submitted: | 18 Feb 2009 4:07 | Modified: | 22 Nov 2010 0:32 |
Reporter: | Igor Babaev | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 6.0-bzr | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[18 Feb 2009 4:07]
Igor Babaev
[18 Feb 2009 4:13]
Igor Babaev
This bug originally was reported to me by Gene Pang from Google. Gene used a different database schema with 5 InnoDB tables. He demonstrated the problem with a slightly modified code to force using the BKA algorithm when optimizer did not use it at all.
[18 Feb 2009 6:44]
Sveta Smirnova
Thank you for the report. Verified as described.
[5 Mar 2009 5:38]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/68302 2727 Igor Babaev 2009-03-04 Fixed bug #42955. If a join buffer is employed to join a table through BNL or BKA algorithm for a query with a ORDER BY / GROUP BY clause then the result set has always to be sorted unless the clause can be optimized away.
[10 Mar 2009 1:59]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/68726 2727 Igor Babaev 2009-03-09 Fixed bug #42955. If a join buffer is employed to join a table through BNL or BKA algorithm for a query with a ORDER BY / GROUP BY clause then the result set has always to be sorted unless the clause can be optimized away.
[20 Apr 2009 15:47]
Bugs System
Pushed into 6.0.11-alpha (revid:sergefp@mysql.com-20090417211236-fy28y9o1w8p4ic9m) (version source revid:igor@mysql.com-20090310013411-xxe9x3d9kqxuo6ar) (merge vers: 6.0.11-alpha) (pib:6)
[23 Apr 2009 1:29]
Paul DuBois
Noted in 6.0.11 changelog. A two-way join query with a GROUP BY or ORDER BY clause could produce incorrect results when rows of the first table are accessed by an index compatible with the GROUP BY or ORDER BY list while the second table is joined using the Batched Key Access algorithm.
[15 Jul 2009 15:43]
Philip Stoev
This fix appears to have caused this regression - bug #45267
[16 Aug 2010 6:42]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100816062819-bluwgdq8q4xysmlg) (version source revid:alik@sun.com-20100816062612-enatdwnv809iw3s9) (pib:20)
[13 Nov 2010 16:27]
Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (merge vers: 5.6.99-m4) (pib:21)
[22 Nov 2010 0:32]
Paul DuBois
Noted in 5.6.1 changelog.
[23 Nov 2010 2:16]
Paul DuBois
Correction: No 5.6.1 changelog entry. Bug does not appear in any released 5.6.x version.