MySQL Forums
Forum List  »  Performance

how to 'un-cache' a table, so I can re-run a query at same speed?
Posted by: Bennett Haselton
Date: February 22, 2012 04:26PM

Generally, if I run a query against a table, and then I make some tweak to the table, and then run the query again, I can't tell if my tweaks have made the query run faster. This is because the query is likely to run faster anyway, as a result of the table being queried recently. (Most queries, if you run them twice in a row, seem to run a lot faster the second time.) I assume this is because of caching done by mysql, or the table file itself could be cached in memory by the operating system.

Is there an easy way to "un-set" all the optimizations that take place as a result of a table being queried recently, so that I can tell if my tweaks really do make the query run faster the second time? (So that if I didn't make any tweaks at all, I could expect the table to run at about the same speed.)

Would it be enough just to restart the MySQL service? But even then, if the tables have been recently queried, then the underlying files would presumably still be cached in memory by the OS, and restarting MySQL wouldn't change that.

I could reboot the whole machine, but I'm hoping there's a less drastic option.

So for MySQL power users, if you run a query against a table and see that it's slow, so you make a change to the table -- what do you do then, to see if the query now runs faster as a result of your changes?

Options: ReplyQuote


Subject
Views
Written By
Posted
how to 'un-cache' a table, so I can re-run a query at same speed?
3037
February 22, 2012 04:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.