Mysql – Why does MySQLTuner show query_cache_size (=0)

my.cnfMySQL

Why does MySQLTuner show query_cache_size (=0)?

In the my.cnf, I have

query_cache_type = 1

query_cache_size = 16M

query_cache_limit = 2M

And MySQLTuner's report show this

[!!] Query cache may be disabled by default due to mutex contention.

[OK] Query cache efficiency: 48.5% (2M cached / 5M selects)

[!!] Query cache prunes per day: 28824

[OK] Sorts requiring temporary tables: 0% (23 temp sorts / 9K sorts)

[OK] No joins without indexes

[!!] Temporary tables created on disk: 69% (10K on disk / 15K total)

While MySQLTuner's suggestions show

query_cache_size (=0)

query_cache_type (=0)

query_cache_size (> 16M)

Is my query_cache_size not working due to the suggestion showing "(=0)" and the report showing high query cache prunes per day?

Is this becuase the "Query cache may be disabled by default due to mutex contention." ?

MySQL has been running for 48hrs.

Best Answer

Version 8 will not have Query Cache available, they are suggesting avoiding this crutch for poorly performing or simply expensive queries.

Suggestions for your my.cnf-ini [mysqld] section

query_cache_type=0  # for OFF
query_cache_size=0  # to ensure QC is NOT USED

Not using QC reduces some amount of CPU utilization.