Skip to content
  • Alexey Kopytov's avatar
    9fff9acf
    Bug #48475: DISTINCT is ignored with GROUP BY WITH ROLLUP and · 9fff9acf
    Alexey Kopytov authored
                only const tables
    
    The problem was caused by two shortcuts in the optimizer that
    are inapplicable in the ROLLUP case.
    
    Normally in a case when only const tables are involved in a
    query, DISTINCT clause can be safely optimized away since there
    may be only one row produced by the join. Similarly, we don't
    need to create a temporary table to resolve DISTINCT/GROUP
    BY/ORDER BY. Both of these are inapplicable when the WITH
    ROLLUP modifier is present.
    
    Fixed by disabling the said optimizations for the WITH ROLLUP
    case.
    9fff9acf
    Bug #48475: DISTINCT is ignored with GROUP BY WITH ROLLUP and
    Alexey Kopytov authored
                only const tables
    
    The problem was caused by two shortcuts in the optimizer that
    are inapplicable in the ROLLUP case.
    
    Normally in a case when only const tables are involved in a
    query, DISTINCT clause can be safely optimized away since there
    may be only one row produced by the join. Similarly, we don't
    need to create a temporary table to resolve DISTINCT/GROUP
    BY/ORDER BY. Both of these are inapplicable when the WITH
    ROLLUP modifier is present.
    
    Fixed by disabling the said optimizations for the WITH ROLLUP
    case.
Loading