当前位置:网站首页>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
边栏推荐
猜你喜欢
Machine vision series (01) -- Overview
BTree、B+Tree和HASH索引
FSM有限状态机
On BFC (block formatting context)
菜菜的刷题日记 | 蓝桥杯 — 十六进制转八进制(纯手撕版)附进制转换笔记
Meishe helps Baidu "Duka editing" to make knowledge creation easier
h5本地存储数据sessionStorage、localStorage
菜菜的并发编程笔记 |(九)异步IO实现并发爬虫加速
Discussion on arrow function of ES6
王者荣耀-unity学习之旅
随机推荐
Moment.js中format方法函数的格式
[ACM-ICPC 2018 沈阳赛区网络预赛] J.Ka Chang (分块+dfs序)
Educational Codeforces Round 81 (Rated for Div. 2)
组合数求解与(扩展)卢卡斯定理
数据分析入门 | kaggle泰坦尼克任务(三)—>探索数据分析
vim+ctags+cscpope开发环境搭建指南
The difference and application of VR, AR and MR, as well as some implementation principles of AR technology
What is a closure?
图论入门——建图
1.查看数据库和表
Mysql的存储引擎
Django使用mysql数据库报错解决
VR、AR、MR的区别与应用,以及对AR技术的一些实现原理
页面实时显示当前时间
数论分块(整除分块)
[2020WC Day2]F.采蘑菇的克拉莉丝(子树和查询、轻重儿子思想)
SAP RFC_CVI_EI_INBOUND_MAIN BP主数据创建示例(仅演示客户)
Visualization Road (IX) detailed explanation of arrow class
Background management system framework, there is always what you want
莫比乌斯反演