• mhansson/martin@linux-st28.site's avatar
    Bug #30596 GROUP BY optimization gives wrong result order · 98d34d62
    mhansson/martin@linux-st28.site authored
      
    The optimization that uses a unique index to remove GROUP BY did not 
    ensure that the index was actually used, thus violating the ORDER BY
    that is implied by GROUP BY.
    Fixed by replacing GROUP BY with ORDER BY if the GROUP BY clause contains
    a unique index over non-nullable field(s). In case GROUP BY ... ORDER BY 
    null is used, GROUP BY is simply removed.
    98d34d62
group_by.test 34.9 KB