While trying to optimize a MySQL query, I ran into a problems trying to avoid MySQL and disk caching which was making it impossible to accurately benchmark two different queries. Fortunately, I was running MySQL on a Centos box and this enabled me to run two quick commands that provided a "fresh" enviornment for each query benchmark.
echo 3 > /proc/sys/vm/drop_caches
service mysql restart
The first command clears the disk cache. The second restarts MySQL. Now, each query can be evaluated on its merits and not how well MySQL and Centos try to optimize performance.