当前位置:网站首页>[MySQL] index classification
[MySQL] index classification
2022-07-01 22:54:00 【Zhang Yanwei_ Laura】
Briefly understand the various categories of indexes and how indexes are created and deleted .
【 Text 】
One 、 Classification of indexes
MySQL The index of includes the general index 、 Uniqueness index 、 Full-text index 、 Single index 、 Multi column index, spatial index, etc .
● In terms of functional logic , The index mainly includes 4 Kind of , They are ordinary indexes 、 unique index 、 primary key 、 Full-text index .
● According to the physical realization , The index can be divided into 2 Kind of : Clustered index and non clustered index .
● It is divided according to the number of action fields , Divided into single column index and joint index .
1. General index
When creating a normal index , Without any restrictions , Just to improve query efficiency . This kind of index can be created in any data type , Whether its value is unique and non empty , It is determined by the integrity constraints of the field itself . After indexing , You can query by index , for example , In the table student Field of name Build a general index on , When querying records, you can query according to the index .
2. Uniqueness index
Use UNIQUE Parameter can be set as unique index , When creating a unique index , Limit the value of this index to be unique , But you can have an empty value , There can be multiple unique indexes in a data table .
3. primary key
Primary key index is a special unique index , On the basis of the unique index, a non NULL constraint is added , That is to say NOT NULL+UNIQUE There is at most one primary key index in a table
Why? , This is determined by the physical implementation of the primary key index , Because data stored in files can only be stored in one order .
4. Single index
Create an index on a single field in a table , A single column index is indexed only according to the field , A single column index can be a normal index , It can also be a unique index , It can also be full-text indexing , It is mainly to ensure that the index only corresponds to one field , A table can have multiple single-column indexes .
5. Multiple columns ( Combine 、 union ) Indexes
Multi column index is to create an index on multiple field combinations of a table . The index points to the corresponding fields at the time of creation , You can query through these fields , But only when the first of these fields is used in the query criteria .
for example : Fields in the table Id name and gender Build a multi column index on idx_id_name_gender, Only fields used in query criteria Id The index will only be used , When using a composite index, follow the leftmost prefix set .
6. Full-text index

7. Add : Spatial index
Summary : Different storage engines support different index types :
InnoDB : Support B-tree、Full-text Wait for the index , I won't support it Hash Indexes ;
MyISAM : Support B-tree、Full-text Wait for the index , I won't support it Hash Indexes ;
Memory : Support B-tree、Hash Wait for the index , I won't support it Full-text Indexes ;
NDB : Support Hash Indexes , I won't support it B-tree、Full-text Wait for the index ;
Archive : I won't support it B-tree、Hash、Full-text Wait for the index ;
边栏推荐
- Origin2018安装教程「建议收藏」
- Slope compensation
- 使用 EMQX Cloud 实现物联网设备一机一密验证
- Friendly serial assistant tutorial_ How to configure friendly serial port debugging assistant - tutorial on using friendly serial port debugging assistant
- Use and function of spark analyze command map join broadcast join
- 正则系列之量词(Quantifiers)
- SAP 智能机器人流程自动化(iRPA)解决方案分享
- 好友新书发布,祝贺(送福利)
- LC501. Mode in binary search tree
- General use of qstringlist
猜你喜欢

转载csdn文章操作

Fiori applications are shared through the enhancement of adaptation project

SAP UI5 应用开发教程之一百零四 - SAP UI5 表格控件的支持复选(Multi-Select)以及如何用代码一次选中多个表格行项目

Appium automated testing foundation - Supplement: introduction to desired capabilities parameters

Cut noodles C language

104. SAP UI5 表格控件的支持复选(Multi-Select)以及如何用代码一次选中多个表格行项目

"Trust machine" empowers development

MySQL5.7 设置密码策略(等保三级密码改造)

internal field separator

Configure filter
随机推荐
What class loading mechanisms does the JVM have?
Use and function of spark analyze command map join broadcast join
[literacy] deep / shallow, local / global features in machine learning image processing
Map container
Réimpression de l'article csdn
Deadlock handling strategies - prevent deadlock, avoid deadlock, detect and remove deadlock
SAP intelligent robot process automation (IRPA) solution sharing
Arlo's thinking after confusion
Rust语言——小小白的入门学习05
下班前几分钟,我弄清了v-model与.sync的区别
效率提升 - 鼓捣个性化容器开发环境
Understanding of transactions in MySQL
内部字段分隔符
map容器
rxjs Observable of 操作符的单步调试分析
MySQL stored procedure
Niuke monthly race - logarithmic sum in groups
Resttemplate remote call tool class
聊一聊Zabbix都监控哪些参数
友善串口助手使用教程_友善串口调试助手怎么进行配置-友善串口调试助手使用教程…