關於 PHP, Linux, Open Source 及個人生活記載的網誌。
RSS icon
  • 開啟 MySQL query cache

    Posted on March 25th, 2006 Sam Tang 1 comment

    如果 MySQL server 是非常繁忙,可以開啟 query cache 以加速回應時間,開啟方法可以在 my.cnf 裡面加入以下項目: (Redhat 下面是 /etc/my.cnf;Debian 是在 etc/mysql/my.cnf)

    query_cache_size = 268435456
    query_cache_type = 1
    query_cache_limit = 1048576

    以上語法的設定裡面,query_cache_size 是分配 256MB 記憶體空間給 query cache;query_cache_type 設定成 1,是給所有的查詢做 cache;query_cache_limit 是指定個別的查詢語句 1KB 的記憶體空間。

    這些數值可根據自己的需要作出更改,設定及存檔後,重新啟動 MySQL 即可。


     

    One response to “開啟 MySQL query cache”

    1. good
      正需要

    Leave a reply

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word