Joinutility seperatorLogin utility separator Infobright.com
   
2 of 2
2
Why Stored Function Can’t With Parameters
Posted: 26 January 2011 03:12 AM   Ignore ]   [ # 16 ]  
Newbie
Rank
Total Posts:  31
Joined  2011-01-20

Thanks for your advices.

Profile
 
Posted: 26 January 2011 08:56 AM   Ignore ]   [ # 17 ]  
Super Duper Member
Avatar
RankRankRankRankRank
Total Posts:  964
Joined  2008-08-18

Hi !

An expression is treated as constant if it
a) is deterministic, so it gives same results every time evaluated with same parameters
b) does not have parameters from tables

Apparently stored function are considered by mysql as non-deterministic and you have changed it. I agree with Jakub - while it works in your case the change is not fully safe in the sense that one can write a non-deterministic function, which would be considered as a deterministic one.

ICE examines the parameter list (on the query level - which columns are used as the input parameters) and it sees there are no parameters.

The combination of the two above give the observed speedup. Good work on the code!

Profile
 
   
2 of 2
2