当前位置:网站首页>MySQL index
MySQL index
2022-04-23 07:41:00 【cqwoniu】
1、 What is index
In a relational database , The index is a separate 、 A storage structure that physically sorts the values of one or more columns in a database table , It is a collection of one or more column values in a table and a corresponding list of logical pointers to the data pages in the table that physically identify these values . The function of index is equivalent to the catalogue of books , You can quickly find the required content according to the page number in the table of contents .
2、 Classification of indexes
a、 primary key : When set as the primary key, the data will be indexed automatically ,innodb Index for clustering .
b、 Single value index : That is, an index contains a single column , A table can have multiple single-column indexes , Also called general index
c、 unique index : The value of the index must be unique , But you can have an empty value , The biggest difference between it and the primary key index is that the primary key index cannot have a null value , But a unique index is allowed to have a null value
d、 Composite index : That is, an index contains multiple columns
e、 Full-text index :innodb I won't support it ,fulltext type .

3、 The principle of indexing
The bottom layer is B+ Tree structure , Only leaf nodes can store key And data , Non leaf nodes can only store key.
B+ Each node of the tree can contain more nodes , This reduces the height of the tree , The data range becomes multiple intervals , The more intervals , Faster data retrieval . Leaf nodes are connected with two pointers , Conforms to the read ahead feature of the disk , Higher performance of sequential query .
Why there is no choice B Trees , because B The tree requires that non leaf nodes must store data .

4、 The difference between clustered index and non clustered index
Clustered index puts data storage and index together , The leaf node of the index structure holds the data , The primary key index must be a clustered index ;
Non clustered indexes store data separately from indexes , The leaf node of the index structure points to the corresponding position of the data .
stay innodb in , An index created on a clustered index is called a secondary index , A non clustered index is called a secondary index .
5、 Advantages of clustering index , What should cluster index pay attention to , Why do primary keys usually suggest self increment id

6、 Under what circumstances, indexes cannot be used 
7、Innodb And Myisam The difference between

版权声明
本文为[cqwoniu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230622032117.html
边栏推荐
- Django使用mysql数据库报错解决
- 菜菜的并发编程笔记 |(九)异步IO实现并发爬虫加速
- Applet newline character \ nfailure problem resolution - Daily pit stepping
- 菜菜的并发编程笔记 |(五)线程安全问题以及Lock解决方案
- Nacos / sentinel gateway current limiting and grouping (code)
- 数论分块(整除分块)
- 安装配置淘宝镜像npm(cnpm)
- (扩展)BSGS与高次同余方程
- [CF 1425D]Danger of Mad Snakes(组合计数+容斥)
- 反思 | 事件总线的局限性,组件化开发流程中通信机制的设计与实现
猜你喜欢

SAP PI/PO rfc2Soap 发布rfc接口为ws示例

AuthorizationServer(授权服务器的简单搭建)

Authorization+Token+JWT

redis连接出错 ERR AUTH <password> called without any password configured for the default user.

Lead the industry trend with intelligent production! American camera intelligent video production platform unveiled at 2021 world Ultra HD Video Industry Development Conference

‘npm‘不是内部或外部命令,也不是可运行的程序 或批处理文件

安装配置淘宝镜像npm(cnpm)

菜菜的并发编程笔记 |(九)异步IO实现并发爬虫加速

直观理解熵

基于可视化结构的身份证号码校验系统-树莓派实现
随机推荐
VIM使用
菜菜的刷题日记 | 238.除自身以外数组的乘积
h5本地存储数据sessionStorage、localStorage
数据分析入门 | kaggle泰坦尼克任务(四)—>数据清洗及特征处理
推导式与正则式
ESP32学习-GPIO的使用与配置
【自我激励系列】到底是什么真正阻碍了你?
Javscript gets the real suffix of the file
通用型冒泡、选择、插入、希尔、快速排序的代码实现
Learn to use search engines
Reflection on the systematic design of Android audio and video caching mechanism
[CodeForces - 208E] Blood Cousins(k代兄弟问题)
H5 case development
(扩展)BSGS与高次同余方程
理解补码的要点
嵌入式相关面经(一)
[hdu6833]A Very Easy Math Problem(莫比乌斯反演)
Reflect on the limitations of event bus and the design and implementation of communication mechanism in component development process
Background management system framework, there is always what you want
BTree、B+Tree和HASH索引