Introduction to MySql index structure

1. Index overview

The concept of index
insert image description here

indexed demo

insert image description here
Advantages and disadvantages of indexing

insert image description here

2. Index structure

insert image description here
The support of the index structure in different storage engines, the index we usually refer to, unless otherwise specified, is the index organized by the B+ tree structure.
insert image description here

2.1 Binary tree and red-black tree index structure

Data structure visualization website: https://www.cs.usfca.edu/~galles/visualization/Algorithms.html
Red-black tree is essentially a binary tree
insert image description here

2.2 B-Tree index structure

insert image description here
B-Tree visualization evolution website: https://www.cs.usfca.edu/~galles/visualization/BTree.html
insert image description here

2.3 Introduction to B+Tree

  • The sub-leaf nodes mainly serve as indexes, and the leaf nodes are mainly used to store data.
  • All data will appear in the leaf nodes.
  • The leaf nodes form a singly linked list.

B+Tree demo website: https://www.cs.usfca.edu/~galles/visualization/BPlusTree.html
insert image description here
insert image description here
Why does the InnoDB storage engine choose to use the B+Tree index structure? ?
insert image description here

2.4 Hash Index Introduction

insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/weixin_44860226/article/details/131628070