当前位置:网站首页>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
边栏推荐
- 推导式与正则式
- On BFC (block formatting context)
- Object. Create() principle, object Create() specification, handwritten object create(),Object. Create() usage
- 反思|开启B站少女心模式,探究APP换肤机制的设计与实现
- 数论之阶与原根讲解
- ‘npm‘不是内部或外部命令,也不是可运行的程序 或批处理文件
- 每日一题 | 曾被反转链表支配的恐惧
- P1446 [HNOI2008]Cards(Burnside定理+dp计数)
- H5 case development
- SAP PI/PO rfc2Soap 发布rfc接口为ws示例
猜你喜欢

BTree、B+Tree和HASH索引

Mysql 数据库从设计上的优化

简单易懂的子集dp

SAP PI/PO Soap2Proxy 消费外部ws示例

数据分析入门 | kaggle泰坦尼克任务(四)—>数据清洗及特征处理

H5 case development

Source Insight 4.0常见问题

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

h5本地存储数据sessionStorage、localStorage

Reflect on the limitations of event bus and the design and implementation of communication mechanism in component development process
随机推荐
SAP PI/PO Soap2Proxy 消费外部ws示例
[hdu6868]Absolute Math(推式子+莫比乌斯反演)
OpenGL超级宝典初步配置(freeglut、glew、gltools、glut)
Background management system framework, there is always what you want
技能点挖坑
‘npm‘不是内部或外部命令,也不是可运行的程序 或批处理文件
安装配置淘宝镜像npm(cnpm)
图论入门——建图
Design optimization of MySQL database
自定义时间格式(YYYY-MM-DD HH:mm:ss 星期X)
每日一题 | 曾被反转链表支配的恐惧
2022.3.14 阿里笔试
状态同步与帧同步
Dirichlet 前缀和(数论优化式子复杂度利器)
Object. Create() principle, object Create() specification, handwritten object create(),Object. Create() usage
组合数求解与(扩展)卢卡斯定理
基于可视化结构的身份证号码校验系统-树莓派实现
如何SQL 语句UNION实现当一个表中的一列内容为空时则取另一个表的另一列
2. Restricted query
4.多表查询