I have a table of several million records. During production, we find that there is a certain type of request that takes a few seconds.
When I try to reproduce the problem on my machine that was replicating production data, I executed the exact query (obtained from the slow query log) in the mysql client, it took a few seconds as expected. If I then press and enter to repeat it, it will take 0.01 seconds.
I looked through the docs to find out how to turn off caching so that I can play this issue sequentially and want to check if adding an index helps.
Here is what I tried:
RESET QUERY CACHE; FLUSH TABLES;
However, after executing the above commands, re-executing the same request will only take 0.01 seconds.
Something is missing for me. Any ideas?
source
share