MySQL allows us to create select statements with usage of SQL_CACHE and SQL_NO_CACHE options. These options affect caching of query results in the query cache. But for which queries is it better to use SQL_CACHE option and for which SQL_NO_CACHE one? Or maybe it is better doesn’t use it at all?
MySQL allows us to create select statements with usage of SQL_CACHE and SQL_NO_CACHE options.
Share
Generally, you shouldn’t have to use this at all.
SQL_CACHEis only necessary if queries are not cached by default, which they are in the default configuration.SQL_NO_CACHEis useful if you know a particular query will not be used again in the near future, especially if the result set is large. The goal is to avoid cluttering the cache with results which won’t be needed again.