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?
Generally, you shouldn't have to use this at all. SQL_CACHE
is only necessary if queries are not cached by default, which they are in the default configuration. SQL_NO_CACHE
is 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With