Skip to content
  • Tor Didriksen's avatar
    d52cda4c
    Bug#22370382 SUM(DISTINCT ...) GIVES WRONG RESULT · d52cda4c
    Tor Didriksen authored
    Bug#11764126 SUM(DISTINCT) GIVES WRONG RESULT WHEN REDUCING MAX_HEAP_TABLE_SIZE
    
    MySQL server creates in-memory data structures in order to execute
    queries of the form
      SELECT SUM(DISTINCT col) sm FROM tab;
    The size of those data structures is limited by the value of the
    system variable max_heap_table_size.
    
    If the table contains many distinct values, intermediate data will be
    written to disk, and later re-merged. There was a bug in this
    merge algorithm, which may lead to incorrect results.
    The workaround was to increase the value of max_heap_table_size.
    
    This patch fixes the merge algorithm.
    d52cda4c
    Bug#22370382 SUM(DISTINCT ...) GIVES WRONG RESULT
    Tor Didriksen authored
    Bug#11764126 SUM(DISTINCT) GIVES WRONG RESULT WHEN REDUCING MAX_HEAP_TABLE_SIZE
    
    MySQL server creates in-memory data structures in order to execute
    queries of the form
      SELECT SUM(DISTINCT col) sm FROM tab;
    The size of those data structures is limited by the value of the
    system variable max_heap_table_size.
    
    If the table contains many distinct values, intermediate data will be
    written to disk, and later re-merged. There was a bug in this
    merge algorithm, which may lead to incorrect results.
    The workaround was to increase the value of max_heap_table_size.
    
    This patch fixes the merge algorithm.
Loading