I have a live MySQL database that suddenly started running extremely slowly for relatively simple queries, e.g. simple counts of tables which were 500k in size. These queries that would usually take a second or two last week, were yesterday taking 2-3 minutes to run.
I wasn't sure what the issue was, so I restarted MySQL (no settings changed) on the server and everything started running very quickly again.
I'm trying to understand what might be the possible reasons this happened, and why simply restarting mysql solved this. Could there have been a memory or caching issue? Are there any steps I could take to prevent this happening again?