query_cache_type: enable or disable?

bazaglia picture bazaglia · Jan 20, 2013 · Viewed 16k times · Source

Recently, I moved from standard MySQL to Percona, and used the Percona Wizard to generate my.cnf.

However, I can see that, by default, the generated settings for my.cnf use query_cache_type = 0. (query cache is disabled).

The only thing I run on the server is a Wordpress blog. My questions are:

  1. May I enable query cache?
  2. There are some Wordpress plugins that offer database cache. Is the result similar of enabling query cache?

Answer

Jirilmon picture Jirilmon · Jan 20, 2013

MySQL query cache is a cache mechanism that stores the text of the query (e.g. 'SELECT * FROM users WHERE deleted = 0') and the result of the query into memory. Please check this link to know how to enable mysql query cache in your server.

The wordpress DB cache plugins on the other hand, decreases count of queries to DB by caching queries in temp files (Check your cache directory wp-content/tmp/ for cache files).

Above two paragraphs prove that Wordpress db cache AND mysql query cache are different.

mysql query cache you should enable ONLY IF your site does more mysql reads than writes. since yours is a wordpress site, YES you can try by enabling mysql query cache.

Hope I answered your 2 questions.