MySQL Query Cache

Posted by BRADINO on Bradino See other posts from Bradino or by BRADINO
Published on Tue, 21 Jul 2009 00:20:28 +0000 Indexed on 2010/03/23 5:22 UTC
Read the original article Hit count: 647

Filed under:

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

© Bradino or respective owner

Related posts about mysql