MySql database query cache and WPMU

This page is part of the Caching for WPMU section, be sure to read there for more info !

This is probably the most straightforward cache to put in place for WPMU, and not the least efficient. There are no drawbacks whatsoever to using it, so do it.

The mysql query cache will store in memory result sets from SELECT type of queries, and serve those directly instead of actually running the query until the accessed table has been modified.

To turn on the mysql query cache, find your my.cnf file (generally in /etc/my.cnf or /etc/mysql/my.cnf ) and add the following two lines if they do not exist :

query_cache_limit = 2M
query_cache_size = 256M

This sets the total memory allocated to caching in mysql to 256M, while no result sets larger than 2M will be stored (very large result sets are better not cached, because they consume lots of memory, and you’re not sure that’s useful because the query might not be a very common one). Then restart mysql.
256M is just an indication of what can be used, but the optimal value might vary depending on your system and platform activity.
To see if your query cache needs to be made bigger, wait for a few hours (ideally a day) so that your cache gets filled, then run in command line :

mysql -Bse « show status like ‘Qcache_free_memory’ »

(you might need to add user / password information depending on how your mysql is setup).

This line will output how much memory is still free in your query cache. If it’s too low, raise the cache value, if it’s too high, lower it :) .


1 2 3 4
  1. Hi..
    Thanks for the MySQL caching tips,

    anyway, how to clear the cache? any commands?


  2. We like to honor quite a few other net web sites around the net, even though they aren

  3. Here is a great Weblog You might Find Fascinating that we Encourage You

  4. always a massive fan of linking to bloggers that I really like but do not get lots of link really like from

  5. Wonderful story, reckoned we could combine a few unrelated information, nevertheless really worth taking a look, whoa did 1 find out about Mid East has got additional problerms also

  6. check beneath, are some absolutely unrelated sites to ours, nonetheless, they may be most trustworthy sources that we use

  7. we came across a cool web page which you may possibly enjoy. Take a look in the event you want

  8. one of our guests just lately encouraged the following website

  9. here are some hyperlinks to websites that we link to because we think they may be worth visiting

  10. check beneath, are some absolutely unrelated web sites to ours, nevertheless, they’re most trustworthy sources that we use

  11. that is the end of this write-up. Right here you

  12. that would be the end of this report. Here you will uncover some web pages that we feel you

  13. Here are a number of the sites we recommend for our visitors

  14. Here are several of the internet sites we advise for our visitors

  15. one of our visitors a short while ago encouraged the following website

  16. please stop by the sites we follow, such as this one, because it represents our picks in the web

  17. that could be the finish of this post. Right here you will uncover some web-sites that we think you

  18. one of our visitors recently suggested the following website

  19. we came across a cool web-site that you just could possibly enjoy. Take a look if you want

  20. although sites we backlink to below are considerably not associated to ours, we feel they may be really really worth a go as a result of, so possess a look

1 2 3 4

Laisser un commentaire

Le Web Rémunéré |
les codes pokemon |
........l'univers de TINTIN... | | Annuaire | Signaler un abus |
| riadsfes