Insert Buffering

14.5.13.4 Insert Buffering

  Database applications often insert new rows in the ascending order of the primary key. In this case, due to the layout

of the clustered index in the same order as the primary key, insertions into an InnoDB table do not require random reads

from a disk.

  On the other hand, secondary indexes are usually nonunique, and insertions into secondary indexes happen in a relatively

random order. In the same way, deletes and updates can affect data pages that are not adjacent in secondary indexes. This

would cause a lot of random disk I/O operations without a special mechanism used in InnoDB.

  When an index record is inserted, marked for deletion, or deleted from a nonunique secondary index, InnoDBchecks whether

the secondary index page is in the buffer pool. If that is the case, InnoDB applies the change directly to the index page. If the

index page is not found in the buffer pool, InnoDB records the change in a special structure known as the insert buffer. The insert

buffer is kept small so that it fits entirely in the buffer pool, and changes can be applied very quickly. This process is known

as change buffering. (Formerly, it applied only to inserts and was called insert buffering. The data structure is still called the insert

buffer.)

Disk I/O for Flushing the Insert Buffer

  Periodically, the insert buffer is merged into the secondary index trees in the database. Often, it is possible to merge several

changes into the same page of the index tree, saving disk I/O operations. It has been measured that the insert buffer can speed

up insertions into a table up to 15 times.

  The insert buffer merging may continue to happen after the transaction has been committed. In fact, it may continue to

happen after a server shutdown and restart (see Section 14.21.2, “Starting InnoDB on a Corrupted Database”).

  Insert buffer merging may take many hours when many secondary indexes must be updated and many rows have been

inserted. During this time, disk I/O will be increased, which can cause significant slowdown on disk-bound queries. Another

significant background I/O operation is the purge thread (see Section 14.5.12, “InnoDB Multi-Versioning”).

Insert Buffering

时间: 2024-10-10 18:13:29

Insert Buffering的相关文章

MySQL 5.5: InnoDB Change Buffering

To speed up bulk loading of data, InnoDB implements an insert buffer, a special index in the InnoDB system tablespace that buffers modifications to secondary indexes when the leaf pages are not in the buffer pool. Batched merges from the insert buffe

InnoDB关键特性之change buffer

一.关于IOT:索引组织表 表在存储的时候按照主键排序进行存储,同时在主键上建立一棵树,这样就形成了一个索引组织表,一个表的存储方式以索引的方式来组织存储的. 所以,MySQL表一定要加上主键,通过主键来访问MySQL表的性能是最好: 1.显式定义主键:primary key 2.隐式定义主键:如果没有指定主键,MySQL自己会默认建立一个主键(rowid隐藏主键) 1.特点 1.表按照主键排好序,数据按照主键顺序存放(核心原因) 2.主键上有一棵树,叶子节点就是数据节点 3.表本身就是索引,表

[MySQL Reference Manual]14 InnoDB存储引擎

14 InnoDB存储引擎 14 InnoDB存储引擎... 1 14.1 InnoDB说明... 5 14.1.1 InnoDB作为默认存储引擎... 5 14.1.1.1 存储引擎的趋势... 5 14.1.1.2 InnoDB变成默认存储引擎之后... 5 14.1.1.3 InnoDB表好处... 6 14.1.1.4 InnoDB表最佳实践... 6 14.1.1.5 InnoDB表提升... 6 14.1.1.6 InnoDB作为默认存储引擎测试... 6 14.1.1.7 验证In

MYSQL术语表

MYSQL术语表 http://dev.mysql.com/doc/refman/5.6/en/glossary.html MySQL Glossary These terms are commonly used in information about the MySQL database server. This glossary originated as a reference for terminology about the InnoDB storage engine, and th

MySQL 4.1/5.0/5.1/5.5/5.6各版本的主要区别

MySQL 4.1/5.0/5.1/5.5/5.6各版本的主要区别 一.5.0 增加了Stored procedures.Views.Cursors.Triggers.XA transactions的支持,增加了INFORATION_SCHEMA系统数据库. 二.5.1 增加了Event scheduler,Partitioning,Pluggable storage engine API ,Row-based replication.Global级别动态修改general query log和

MySQL的简介及发展历

MySQL的简介MySQL 是一个关系型数据库t管理系统,由瑞典MySQL AB公司开发 MySQL是一种开放源代码的关系型数据库管理系统,因为是开放源代码的,在下载后可以根据自己的需要进行修改. 由于体积小.速度快.总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本需选择了MySQL作为网站数据库. 最开始由SUN公司收购,后面被甲骨文Oracle公司收购 SQL ,NoSQL(Not Only SQL),NewSQL(SQL+NoSQL) 目前全世界市场有比例最高

专利事务所信息Python爬取

数据来源:http://www.acpaa.cn/ 目前事务所的信息没有做反爬限制,还是很容易拿到数据的 没有用html解析工具,直接上正则,结果就是需要处理很多乱七八糟的空格...为了能将日期顺利的插入到数据库,做了很多转换.这个代码没用多线程. 下面是代码,Python版本为3.5,需要安装pymsql,mysql # -*- coding: UTF-8 -*- import http.client import re import pymysql def saveAgency(code,

【Leetcode】Insert Delete GetRandom O(1) - Duplicates allowed

题目链接:https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed/ 题目: Design a data structure that supports all following operations in average O(1) time. Note: Duplicate elements are allowed. insert(val): Inserts an item val to the c

Bulk Insert Syntax

BULK INSERT Imports a data file into a database table or view in a user-specified format. BULK INSERT [ database_name . [ schema_name ] . | schema_name . ] [ table_name | view_name ] FROM 'data_file' [ WITH ( [ [ , ] BATCHSIZE = batch_size ] [ [ , ]