Calculate Cache hits ratio


Im reading on mysqlperformanceblog the way to calculate the cache hits ratio in mysql server. I did the operation but Im not sure. I have this values:

Qcache_hits = 365313
Com_select = 1647910

365313 / (365313+1647910) = 365313 / 2013223 = 0,18

so current hits ratio of query cache is 18%? It’s ok?


You might try increasing your query cache size. Don’t forget that if the content of any of the tables referenced changes, any queries referencing those tables are dropped. So the query cache is only useful for tables that don’t change much. If you’re tables are always changing, the overhead might not be worth it.

Yes, you’re getting an 18% hit ratio.

You might experiment with setting query_cache_type=2 in your configuration file, and using SELECT SQL_CACHE for the queries you wish to cache. es.html#sysvar_query_cache_type

Thanks to answer my post Mark, is nice to know the math to get % ratio is right.

I know is an old post but I need some answer )

I have a very strange results when I want to know the ratio of QCACHE in a MySQL BBDD

Qcache_hits 24508133Com_select 1

This results meaning that we’re having 100% of success with QCACHE?

Thanks a lot!