I've been benchmarking several queries and learning about indexes by using the explain function, profiling and the SQL_NO_CACHE option.
My usual benchmarking session goes something like this:
SET PROFILING=1;
SELECT SQL_NO_CACHE field_a, field_b FROM table WHERE xxx;
SHOW PROFILES;
Some times after adding indexes, I want to know how the query would perform without any index optimization; so my options so far are to either delete the related indexes or use explain to check what indexes are in use and hint MySQL what indexes to ignore;
EXPLAIN SELECT SQL_NO_CACHE field_a, field_b FROM table WHERE xxx;
SELECT SQL_NO_CACHE IGNORE INDEX (field_a) field_a, field_b FROM table WHERE xxx;
SHOW PROFILES;
Is there a similar option to tell MySQL not to use any index so I can get the query duration without any index optimization. Something like this:
SELECT SQL_NO_CACHE SQL_NO_INDEXES field_a, field_b FROM table WHERE xxx;