Innodb特性之change buffer
change buffer官方說明: https://dev.mysql.com/doc/refman/5.7/en/innodb-change-buffer.html
change buffer官方解答: https://dev.mysql.com/doc/refman/5.7/en/faqs-innodb-change-buffer.html
設計背景:
與聚集索引不同,二級索引通常是非唯一的,像delete和update操作的二級索引樹中通常都是順序相對隨機不相鄰的索引頁,
這樣會照成大量隨機I/O
工作機制:
DML(insert,update,delete)操作使用到的二級索引頁如果不在buffer pool中,就把它快取到buffer pool的change buffer中。後續再進行合併操作,批次寫回disk( master thread在伺服器空閒時和slow shutdown期間會合並緩衝更改)。可避免大量隨機I/O
注:change buffer不支援descending index,Clustered indexes,full-text indexes,spatial indexes
控制引數:
innodb_change_buffering :change buffer快取級別有
innodb_change_buffering values include:
-
all 預設開啟
The default value: buffer inserts, delete-marking operations, and purges.
-
none
Do not buffer any operations.
-
inserts
Buffer insert operations.
-
deletes
Buffer delete-marking operations.
-
changes (其實update操作就是做的 inserts and delete-marking)
Buffer both inserts and delete-marking operations.
-
purges
Buffer physical deletion operations that happen in the background.
innodb_change_buffer_max_size:change buffer是buffer pool中一塊區域,5.6版本後預設大小是buffer pool的25%,引數
innodb_change_buffer_max_size
控制。
注:在記憶體中, change buffer佔用buffer pool的一部分。在磁碟上, change buffer是system tablespace的一部分,當資料庫伺服器關閉時,索引更改將在其中緩衝。
使用監控
1
2
3
4
5
6
7
8
9
10
11
12
13
14 |
mysql> SHOW ENGINE INNODB STATUS\G ------------------------------------- INSERT
BUFFER
AND
ADAPTIVE HASH
INDEX ------------------------------------- Ibuf:
size
1,
free
list len 0, seg
size
2, 0 merges #
size
:change buffer中使用的頁數。change buffer大小等於seg
size
-(1+
free
list len) #1+表示change buffer header page使用 seg
size
:更改緩衝區的大小,以頁為單位。 merged operations:
insert
0,
delete
mark 0,
delete
0 discarded operations:
insert
0,
delete
mark 0,
delete
0 Hash
table
size
4425293, used cells 32, node heap has 1 buffer(s) 13577.57 hash searches/s, 202.47 non-hash searches/s |
change buffer 佔用率
1
2
3
4
5
6
7
8
9
10 |
mysql>
SELECT
(
SELECT
COUNT
(*)
FROM
INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE
PAGE_TYPE
LIKE
'IBUF%'
)
AS
change_buffer_pages,
(
SELECT
COUNT
(*)
FROM
INFORMATION_SCHEMA.INNODB_BUFFER_PAGE)
AS
total_pages,
(
SELECT
((change_buffer_pages/total_pages)*100))
AS
change_buffer_page_percentage; +
---------------------+-------------+-------------------------------+ | change_buffer_pages | total_pages | change_buffer_page_percentage | +
---------------------+-------------+-------------------------------+ | 25 | 8192 | 0.3052 | +
---------------------+-------------+-------------------------------+ |
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69978212/viewspace-2729609/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL 引擎特性:InnoDB Buffer PoolMySql
- Innodb特性之Read-Ahead(Buffer Pool Prefetching)
- MySQL 5.7新特性之動態修改innodb_buffer_pool大小MySql
- MySQL學習之change buffer 和 redo logMySql
- mysql change buffer小結MySql
- mysql引數之innodb_buffer_pool_size大小設定MySql
- 技術分享 | MySQL:change buffer 何時生效MySql
- 全網最清楚的:MySQL的insert buffer和change buffer 串講MySql
- InnoDB關鍵特性之自適應hash索引索引
- mysql的唯一索引不會利用change bufferMySql索引
- MySQL innodb_buffer_pool_size 變數MySql變數
- 給從庫預熱innodb buffer pool
- mysql 5.5 -- innodb buffer pool最佳化MySql
- MySQL innodb buffer pool 命中率以及快取了哪些 InnoDB TableMySql快取
- Innodb關鍵特性之重新整理鄰接頁
- 【Mysql】讀書筆記之--innodb_buffer_pool記憶體的管理MySql筆記記憶體
- mysql innodb_log_file_size 和innodb_log_buffer_size引數MySql
- 計算innodb_buffer_pool使用率
- ubuntu 命令列更改innodb_buffer_pool_sizeUbuntu命令列
- 【Mysql】mysql快速預熱innodb_buffer_poolMySql
- MySQL監控InnoDB Buffer Pool命中率MySql
- MySQL 資料庫的提速器-寫快取(Change Buffer)MySql資料庫快取
- Mysql核心:INNODB儲存引擎--《十一》Insert BufferMySql儲存引擎
- innodb plugin-Making Buffer Cache Scan ResistantPlugin
- IO之核心buffer----"buffer cache"
- MySQL change buffer介紹和相關引數調整建議MySql
- MySQL 引擎特性:InnoDB 同步機制MySql
- MySQL服務端innodb_buffer_pool_size配置引數MySql服務端
- Java NIO之BufferJava
- MySQL 引擎特性:InnoDB IO 子系統MySql
- MySQL 引擎特性:InnoDB崩潰恢復MySql
- XTTS全備開啟BCT後等待事件 block change tracking buffer spaceTTS事件BloC
- percona save/restore buffer pool特性記錄REST
- 啟用Block Change Tracking-10g新特性BloC
- 【BUFFER】Oracle buffer cache之 latch 學習記錄Oracle
- MYSQL innodb buffer 狀態資料的儲存和載入MySql
- NodeAPI學習之BufferAPI
- Node.js之BufferNode.js