I am working with a very high traffic site where few mysql table is experiencing crash very frequently. I tried adding index and other but crash is happening. Now I am trying to auto repair while its crashed. I can find the crash table with below query
show table status where comment like '%crash%'
And can make a repair with below query
REPAIR TABLE `mytable`;"
what my idea is to check crash table with a count query
then if count>0
then run the above repair table query. Is it possible to put above show table status
query in a count function or there is another way