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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Innodb特性之Read-Ahead(Buffer Pool Prefetching)
- MySQL學習之change buffer 和 redo logMySql
- mysql change buffer小結MySql
- 全網最清楚的:MySQL的insert buffer和change buffer 串講MySql
- 技術分享 | MySQL:change buffer 何時生效MySql
- mysql的唯一索引不會利用change bufferMySql索引
- InnoDB關鍵特性之自適應hash索引索引
- MySQL innodb_buffer_pool_size 變數MySql變數
- InnoDB 中的緩衝池(Buffer Pool)
- 給從庫預熱innodb buffer pool
- MySQL innodb buffer pool 命中率以及快取了哪些 InnoDB TableMySql快取
- Innodb關鍵特性之重新整理鄰接頁
- 計算innodb_buffer_pool使用率
- ubuntu 命令列更改innodb_buffer_pool_sizeUbuntu命令列
- Change Buffer 只適用於非唯一索引頁?錯索引
- MySQL 資料庫的提速器-寫快取(Change Buffer)MySql資料庫快取
- InnoDB Buffer Pool改進LRU頁面置換
- MySQL change buffer介紹和相關引數調整建議MySql
- IO之核心buffer----"buffer cache"
- XTTS全備開啟BCT後等待事件 block change tracking buffer spaceTTS事件BloC
- MySQL服務端innodb_buffer_pool_size配置引數MySql服務端
- Java NIO之BufferJava
- 【BUFFER】Oracle buffer cache之 latch 學習記錄Oracle
- NodeAPI學習之BufferAPI
- Node.js之BufferNode.js
- google protocol buffer——protobuf的使用特性及編碼原理GoProtocol
- MySQL 8.0 Reference Manual(讀書筆記72節--InnoDB Buffer Pool Configuration (3))MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記70節--InnoDB Buffer Pool Configuration (1))MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記71節--InnoDB Buffer Pool Configuration (2))MySql筆記
- Java NIO之Buffer的使用Java
- MySQL:一段innodb buffer instance和cleaner執行緒計算邏輯MySql執行緒
- Oracle redo解析之-3、常見change分析Oracle Redo
- 關於 Node.js 之 BufferNode.js
- Java NIO 之 Buffer(緩衝區)Java
- sqlserver Change Data Capture&Change TrackingSQLServerAPT
- InnoDB引擎之flush髒頁
- InnoDB學習(一)之BufferPool
- InnoDB學習(三)之BinLog