Open main menu

Changes

94 bytes added ,  10:05, 28 January 2020
add reference
== Caching ==
One thing you should look at is the query cache. By default, the query cache is turned off. You should turn it on, and set it in the tens of megabytes to see how it affects performance (like 80MB for starters). A huge cache will hurt performance (don't give it 4GB just because you have 32GB of RAM). But some amount of cache will definitely improve performance. So you just have to find the sweetspot for your hardware and application. That being said, if your tables are exclusively InnoDB tables, then you might be able to turn query cache off. <ref>Hayden James: https://haydenjames.io/mysql-query-cache-size-performance/</ref> <ref>https://dev.mysql.com/doc/refman/5.7/en/query-cache-status-and-maintenance.html</ref> <ref>https://dba.stackexchange.com/questions/167271/mariadb-mysql-tuner-report-confusing</ref>
The cache is for SELECT queries obviously. Any insert or update invalidates the cache so you can't get stale data from cache. Low memory prunes indicates how many queries are being removed to make room for new queries that are being cached and the cache prune strategy is LRU (least recently used) so that queries that are seen the most frequently are the ones that get priority for caching. It wouldn't make much sense to cache a query that is rare v. a query that is used on every page load.