Search the MySQL manual:

6.9 MySQL Query Cache

From version 4.0.1, MySQL server features a Query Cache. When in use, the query cache stores the text of a SELECT query together with the corresponding result that was sent to the client. If an identical query is later received, the server will retrieve the results from the query cache rather than parsing and executing the same query again.

NOTE: The query cache does not return stale data. When data is modified, any relevant entries in the query cache are flushed.

The query cache is extremely useful in an environment where (some) tables don't change very often and you have a lot of identical queries. This is a typical situation for many web servers that use a lot of dynamic content.

Below is some performance data for the query cache. (These results were generated by running the MySQL benchmark suite on a Linux Alpha 2 x 500 MHz with 2 GB RAM and a 64 MB query cache):

Subsections

User Comments

Posted by Seth Coleman on Wednesday July 23 2003, @8:47am[Delete] [Edit]

To anybody out there needing a possible boost in database performance, I highly recommend setting the query_cache! We set the variable and noticed pages loading atleast 10 - 20 times faster in a production instance. This is a must if information is constantly being selected out and displayed.

Add your own comment.