当前位置:网站首页>MySQL review
MySQL review
2022-06-12 12:06:00 【Star field_ 03zhan】
List of articles
Mind mapping :
server layer :
Index failure :
Concurrency issues :
Transaction characteristics and isolation levels ?
Talk to you about B+ Understanding of trees ?
I have learned that B+ The tree is because it is InnoDB Index of storage engine .
stay InnoDB in ,B+ Each node in the tree is a data page , A directory of pages stored in a data page , Maximum record, minimum record and other information .
B+ The tree only stores data in the leaf node , Other non leaf nodes store directories as indexes .
Its non leaf nodes are divided into different levels , Reduce the amount of search in each layer by layering .
And all its nodes are sorted by index value size , Form a two-way linked list , Easy range query .
Why? InnoDB Use B+ Trees , Instead of using B Trees ?
B Each node of the tree contains data and indexes ,B+ Only leaf nodes in the tree contain data , There are only indexes in non leaf nodes . Such a structure ,B+ The non leaf nodes of the tree can store more indexes , With the same amount of data . This will make B+ Tree ratio B The trees are fatter , The number of layers of the tree is related to the disk I/O Number of visits , The shorter the tree , The fewer visits , by comparison ,B+ Trees can reduce the number of disks I/O Number of visits , Increase of efficiency .
B+ The tree has a large number of redundant nodes ( All non leaf nodes are redundant indexes ), During delete and insert operations , Don't like B A complex deformation of a tree occurs like a tree
B+ The leaf nodes of the tree are connected by linked lists , Conducive to range query , and B The tree does not use linked list connection , Not conducive to range query , To implement a range query , You have to traverse the whole tree , This designs disks with multiple nodes I/O operation , Reduced efficiency .
Talk about your understanding of clustering index ?
Cluster index means that the leaf nodes of the tree store actual data , A table can only have one clustered index .
Clustered indexes usually select the primary key column as the index key , If there is no primary key , Then select the first column without null value and with unique constraint as the index key , If none of the above two situations ,InnoDB An implicit id Automatic column as index key .
Talk about your understanding of secondary index ?
A secondary index is also called a nonclustered index , Its leaf nodes do not store actual data , Is the primary key value .
A table can have multiple secondary indexes .
When querying the secondary index , If you want to query the primary key value , You only need to query the secondary index , Just need to query one tree B+ Trees . This does not require querying the clustered index , This is also called Index overlay . But if you want to query the actual data , You need to query the secondary index , Then query the cluster index , Query the desired data in the clustered index according to the primary key value obtained from the secondary index query . You need to query two B+ Trees , This is also called Back to the table .
边栏推荐
猜你喜欢
随机推荐
Tpage design
Pytorch笔记
Clone with cloneNode to solve the id problem / methods deep copy and shallow copy to modify the ID
什么是模块化?模块化的好处
6.6 rl:mdp and reward function
LeetCode 1037. Effective boomerang (vector cross product)
TinyMCE series (I) TinyMCE environment construction
服务端渲染与客户端渲染的区别(优缺点)
Inter class and intra class relations in video classification -- regularization
ARM指令集之跳转指令
机器学习基础概念
The second day of QML study
【深度学习基础】神经网络的学习(4)
Load/store access instruction of arm instruction set (2)
Getting started with NVIDIA Jetson nano Developer Kit
System. IO. Fileloadexception exception
object.defineProperty 基本使用
QT添加QObject类(想使用信号和槽)遇到的问题汇总,亲测解决有效error: undefined reference to `vtable for xxxxxx(你的类名)‘
Lambda and filter, index of list and numpy array, as well as various distance metrics, concatenated array and distinction between axis=0 and axis=1
Chaîne la plus longue sans caractères dupliqués (leetcode 3)







