Am I clearing the query cache correctly? I'm trying to optimize a query but need to make sure the query cache is cleared properly for obvious reasons, however it doesn't seem to be working.

I ran a query the first time and it took about 3.5 seconds and all additional times it took approx 0.25 seconds; however I made some changes to it and now want to test it again without relying on the cache.

I ran:

RESET QUERY CACHE;


...and then reran the query, but it doesn't seem to have had much affect as the execution times I am getting on the first run are approx 0.35 seconds and once again approx 0.25 seconds on any additional runs.

Is there another way to do this or do you think the first ever run was an outlier?
To bypass the query cache you need to change your SELECT to SELECT SQL_NO_CACHE.

This will allow you to properly benchmark your query performance.

Be aware, that this does NOT affect the InnoDB buffer pool. Whether or not the pool is populated will also affect performance.

A good rule of thumb is to run one query (with SQL_NO_CACHE), discard the result, and then run the query 3 more times to get a good idea of how fast the query is with the buffer pool populated.