Skip to content
  • Jorgen Loland's avatar
    37262782
    BUG#11761078: 53534: INCORRECT 'SELECT SQL_BIG_RESULT...' · 37262782
    Jorgen Loland authored
                  WITH GROUP BY ON DUPLICATED FIELDS
    
    If a GROUP BY clause contains duplicates of the same field
    and group range access is used to resolve the query, the optimizer
    incorrectly believed that the range access would not provide 
    the ordered output required to do grouping. Thus, the already
    ordered rows were ordered once more using filesort (which yields
    correct result but is not optimal). end_send() then thought 
    that group range access method had not been used (see 
    is_using_loose_index_scan()) and therefore did not copy 
    non-aggregated fields to the resultset.
    
    The fix is to remove duplicated (and redundant) fields from 
    the GROUP BY and ORDER BY clauses, which in turns makes 
    the optimizer realize that the output of the range access method
    is, in fact, ordered.
    37262782
    BUG#11761078: 53534: INCORRECT 'SELECT SQL_BIG_RESULT...'
    Jorgen Loland authored
                  WITH GROUP BY ON DUPLICATED FIELDS
    
    If a GROUP BY clause contains duplicates of the same field
    and group range access is used to resolve the query, the optimizer
    incorrectly believed that the range access would not provide 
    the ordered output required to do grouping. Thus, the already
    ordered rows were ordered once more using filesort (which yields
    correct result but is not optimal). end_send() then thought 
    that group range access method had not been used (see 
    is_using_loose_index_scan()) and therefore did not copy 
    non-aggregated fields to the resultset.
    
    The fix is to remove duplicated (and redundant) fields from 
    the GROUP BY and ORDER BY clauses, which in turns makes 
    the optimizer realize that the output of the range access method
    is, in fact, ordered.
Loading