• Georgi Kodinov's avatar
    Bug#37662 nested if() inside sum() is parsed in exponential time · 425abb49
    Georgi Kodinov authored
          
    min() and max() functions are implemented in MySQL as macros.
    This means that max(a,b) is expanded to: ((a) > (b) ? (a) : (b))
    Note how 'a' is quoted two times.
    Now imagine 'a' is a recursive function call that's several 10s of levels deep.
    And the recursive function does max() with a function arg as well to dive into
    recursion.
    This means that simple function call can take most of the clock time.
    Identified and fixed several such calls to max()/min() : including the IF() 
    sql function implementation.
    425abb49
item.cc 193 KB