HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to decide whether to enable MySQL query cache using InnoDB

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
enableinnodbquerymysqlcachedecideusinghowwhether

Problem

How should the decision to enable / disable the MySQL query cache be made, on a server that uses just InnoDB tables. Say for example, if the cache is enabled, then how should the output of:

SHOW STATUS LIKE 'Qcache%';


be interpreted to make the decision? Or what other queries/profiling can be performed to get more information, and then how should those be interpreted? If it's to be enabled, how should its size be determined? I'm on Amazon RDS, using MySQL 5.6. I will end up being around ~250 separate databases totalling ~200gb in space.

Solution

SHOW GLOBAL STATUS;

Then compute these (whether using MyISAM or InnoDB):

  • Qcache_lowmem_prunes / Uptime -- How often the QC is being pruned -- More than 15/sec says there is a lot of overhead in having the QC on.



  • Qcache_not_cached / Uptime -- Cache attempts failed (per second). >40 is probably bad.



  • Qcache_not_cached / (Qcache_hits + Com_select + Qcache_not_cached) -- Percent of SELECTs that are not cached in the QC -- >30% means the QC is not very useful.



  • Qcache_hits / Qcache_inserts -- Hit to insert ratio -- > 10 is desirable

Context

StackExchange Database Administrators Q#63415, answer score: 5

Revisions (0)

No revisions yet.