CACHE INDEX t1,t2 IN hot_cache、SET GLOBAL hot_cache.key_buffer_size=...、LOAD INDEX INTO CACHE t1 IGNORE LEAVES 預熱。max_connections。建議 ≥ max_connections * N(N=單查詢最大連接表數)。Opened_tables 狀態變數,持續增長需調大。| 值 | 行為 | 安全性 | 效能 |
|---|---|---|---|
| 0 | Log Buffer 每秒寫檔並 fsync,Commit 不動作 | 崩潰丟 1 秒事務 | 最高 |
| 1 | 每 Commit 寫檔並 fsync | 最安全(預設) | 基準 |
| 2 | 每 Commit 寫檔,每秒 fsync | OS 不崩潰不丟資料 | 較好 |
LOCK TABLES 觸發 InnoDB 內部表鎖,AUTOCOMMIT=1 易死鎖。設 0 關閉。--skip-innodb-doublewrite 關閉。