1. 程式人生 > >MySQL優化查詢 5.7版本

MySQL優化查詢 5.7版本

mce 控制 打開 dem src 查詢緩存 lec 設置 code

1. 變更參數 : query_cache_type

如果何配置查詢緩存:

query_cache_type 這個系統變量控制著查詢緩存工能的開啟的關閉。
query_cache_type=0時表示關閉, 1時表示打開, 2表示只要select 中明確指定SQL_CACHE才緩存。

可通過my.cnf手動配置 : query_cache_type=2; 然後重啟mysql.

windows版本下設置為: off, on, demand

阿裏雲設置為: 0, 1, 2

SELECT @@global.query_cache_type;

#顯性指定查詢緩存

select SQL_CACHE * from t_sys_user;

技術分享圖片

技術分享圖片

MySQL優化查詢 5.7版本