If I call a function several time then will it execute every time or just execute once and the value will be used then after several time? Example:
select my_fu
As far as I know (not a mysql pro) it is calling this function every time. Your expalin plan should show that issue.
If you always call the function with the same argument, rather query it once per row via a sub-query.
select funcvalue, funcvalue/field2, (funcvalue*field1)/field3,......
from SELECT( my_function('filed') funcvalue, ... your other columns...
FROM TABLE )
where group by filed1;