>>>> 2013/02/05 17:06 +0000, Rick James >>>>
As a Rule of Thumb, function evaluation time is not significant to the overall time for
running a query. (I see IF and CASE as 'functions' for this discussion.)
Do you have evidence that says that IF is slower? Perhaps using BENCHMARK()?
Not BENCHMARK: I did a query with one, and also with the other, and repeated each at least
a dozen times, and looked at the reported time. The IF-variant took ever so slightly more
time than the CASE-variant.
But which of the arguments are always evaluated, which only at need? This could be a
difference, that IF s arguments always are, CASE s only at need.