MySQL Query Cache

Like this blog? Consider exploring one of our sponsored banner ads...

According to MySQL.com the query cache stores the text of a SELECT statement together with the corresponding result that was sent to the client. If an identical statement is received later, the server retrieves the results from the query cache rather than parsing and executing the statement again. The query cache is shared among sessions, so a result set generated by one client can be sent in response to the same query issued by another client.

Purely hypothetical example:

SELECT `name` FROM `beers` WHERE `favorite` = true

To force the database NOT to give you a cached result simply add SQL_NO_CACHE to the query:

SELECT SQL_NO_CACHE `name` FROM `beers` WHERE `favorite` = true

About this entry