您好,登錄后才能下訂單哦!
InnoDB change buffer 一種重要的數據變更日志
Change buffer的主要目的是將對二級索引的數據操作緩存下來,以此減少二級索引的隨機IO,并達到操作合并的效果。
在MySQL5.5之前的版本中,由于只支持緩存insert操作,所以最初叫做insert buffer,只是后來的版本中支持了更多的操作類型緩存,才改叫change buffer。
當更新/插入的非聚集索引的數據所對應的頁不在內存中時(對非聚集索引的更新操作通常會帶來隨機IO),會將其放到一個insert buffer中,當隨后頁面被讀到內存中時,會將這些變化的記錄merge到頁中。當服務器比較空閑時,后臺線程也會做merge操作
但change buffer會占用buffer pool,并且在非聚集索引很少時,并不總是必要的,反而會降低buffer pool做data cache的能力。
The INFORMATION_SCHEMA.INNODB_BUFFER_PAGE table provides metadata about each page in the buffer pool, including change buffer index and change buffer bitmap pages. Change buffer pages are identified by PAGE_TYPE. IBUF_INDEX is the page type for change buffer index pages, and IBUF_BITMAP is the page type for change buffer bitmap pages.
For example, you can query the INNODB_BUFFER_PAGE table to determine the approximate number of IBUF_INDEX and IBUF_BITMAP pages as a percentage of total buffer pool pages.
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 |
+---------------------+-------------+-------------------------------+
沒有對比,不知道這個結果的性能好壞。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。