Two query cache-related options may be specified in
SELECT
statements:
The query result is cached if it is cacheable and the value of the
query_cache_type
system variable isON
orDEMAND
.SQL_NO_CACHE
The server does not use the query cache. It neither checks the query cache to see whether the result is already cached, nor does it cache the query result. (Due to a limitation in the parser, a space character must precede and follow the
SQL_NO_CACHE
keyword; a nonspace such as a newline causes the server to check the query cache to see whether the result is already cached.)
Examples:
SELECT SQL_CACHE id, name FROM customer;
SELECT SQL_NO_CACHE id, name FROM customer;