MySQL クエリキャッシュ値設定と確認方法 - Qiita
MySQL クエリーキャッシュ 【チューニング方法とかも】 - Qiita
SHOW VARIABLES LIKE '%query_cache_%'; +------------------------------+------------+ | Variable_name | Value | +------------------------------+------------+ | query_cache_limit | 16777216 | | query_cache_min_res_unit | 4096 | | query_cache_size | 1073741824 | | query_cache_type | ON | | query_cache_wlock_invalidate | OFF | +------------------------------+------------+ 5 rows in set (0.00 sec) show global status like "%QCache%"; +-------------------------+------------+ | Variable_name | Value | +-------------------------+------------+ | Qcache_free_blocks | 1525 | | Qcache_free_memory | 1066602576 | | Qcache_hits | 3800550 | | Qcache_inserts | 3649965 | | Qcache_lowmem_prunes | 1327795 | | Qcache_not_cached | 551696 | | Qcache_queries_in_cache | 1880 | | Qcache_total_blocks | 5421 | +-------------------------+------------+ 8 rows in set (0.00 sec)
show global status で取得できる値のうち、いくつかはflush status でreset できる(Uptime、Questions などresetできないのもある) ということを知った。
flush status でmysqlの(一部の)統計情報(show statusの結果)をreset する - うまいぼうぶろぐ
flush status
SHOW GLOBAL STATUS:MySQLを起動してから今までの総計
SHOW SESSION STATUS:「FLUSH STATUS」を実行してから今までの統計
MySQL クエリチューニングと SHOW STATUS | 丸ノ内テックブログ
実質的に無効化
set global query_cache_size = 0;
クエリーキャッシュのサイズを設定するには、query_cache_size システム変数を設定します。それを 0 に設定すると、query_cache_type=0 を設定するのと同様に、クエリーキャッシュが無効になります。
https://dev.mysql.com/doc/refman/5.6/ja/query-cache-configuration.html
ここまで調べて最後にとても重要な事実を見つけてしまった...
MySQL :: MySQL 5.7 Reference Manual :: 8.10.3 The MySQL Query CacheThe query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0.
(クエリキャッシュは5.7.20で非推奨に、8.0で削除されます。)
MySQLのクエリキャッシュについてまとめた。 - Qiita
query_cache_limit
query_cache_limit=2048 (デフォルト 1Mバイト) query_cache_min_res_unit=1024 (デフォルト 4096)
query_cache_limit = 2048
query_cache_min_res_unit = 1K
https://bugs.mysql.com/bug.php?id=68979