MySQL Single Query Benchmarking Strategies

I have a slow mySQL query in my application that I need to rewrite. The problem is that it is only slow on my production server and only when it is not cached. The first time I run it, it will take 12 seconds, then at any time after that there will be 500 milliseconds.

Is there an easy way to verify this query without getting into the query cache so that I can see the results of my refactoring?

Thank!

+5
source share
2 answers

MySQL supports single-query caching prevention. Try

SELECT SQL_NO_CACHE field_a, field_b FROM table;

Alternatively, you can change the query cache for the current session:

SET SESSION query_cache_type = OFF;

. http://dev.mysql.com/doc/refman/5.1/en/query-cache.html

+7

johannes , ,

RESET QUERY CACHE;

, - , , .

, - , , , , - .

+1

All Articles