Here is the simplified version of my query:
SELECT myfunc(u.id) score FROM users u
ORDER BY score
LIMIT 20
As you see, I've used score
(which is the result of myfunc()
function) in the ORDER BY
clause. Now I want to know, will that function be recalled when I use it in ORDER BY
clause? If yes, then how can I avoid that? Because that function needs lots of processing and recalling it twice would be like a nightmare.