optimization - Does mysql query cache the dynamically calculated columns -
i have mysql query:
select my_table.* soundex(my_col)='whatever' or substr(soundex(my_col),4)='whatever' order substr(soundex(my_col),4)='whatever',soundex(my_col)='whatever' how many times substring function , soundex functions called? mean same inputs mysql cache results on span of 1 query?
if not, how can make change in query each function called minimum times possible.
mysql call function 4 times every returned row, avoid can use subquery, instead of
select * song order substr(pre_calculated_soundex, 1, 1) = substr(soundex("aaaa"), 1, 1) + substr(pre_calculated_soundex , 2, 1) = substr (soundex("aaaa"), 2, 1) + substr(pre_calculated_soundex, 3, 1) = substr(soundex("aaaa"), 3, 1) + substr(pre_calculated_soundex, 4, 1 ) = substr(soundex("aaaa"), 4, 1) you can
select * (select *, soundex("aaaa") current_soundex song) order substr(pre_calculated_soundex, 1, 1) = substr(current_soundex , 1, 1) + substr(pre_calculated_soundex, 2, 1) = substr(current_soundex , 2, 1) + substr(pre_calculated_soundex, 3, 1) = substr(current_soundex , 3, 1) + substr(pre_calculated_soundex, 4, 1) = substr(current_soundex , 4, 1)
Comments
Post a Comment