当前位置:网站首页>[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 ;
边栏推荐
- Preparation of functional test report
- 好友新书发布,祝贺(送福利)
- SAP UI5 应用开发教程之一百零四 - SAP UI5 表格控件的支持复选(Multi-Select)以及如何用代码一次选中多个表格行项目
- Appium自动化测试基础 — 补充:Desired Capabilities参数介绍
- Niuke monthly race - logarithmic sum in groups
- 转--原来gdb的底层调试原理这么简单
- Use three JS realize the 'ice cream' earth, and let the earth cool for a summer
- Appium automated testing foundation - Supplement: introduction to desired capabilities parameters
- 转载csdn文章操作
- [untitled]
猜你喜欢
随机推荐
[target tracking] | single target tracking indicator
利用SecureCRTPortable远程连接虚拟机
激发新动能 多地发力数字经济
mixconv代码
447 Bili Bili noodles warp 1
【扫盲】机器学习图像处理中的深层/浅层、局部/全局特征
[jetcache] how to use jetcache
Vsphere+ and vsan+ are coming! VMware hybrid cloud focus: native, fast migration, mixed load
I graduated from college in 14 years and changed to software testing in 3 months. My monthly salary was 13.5k. At the age of 32, I finally found the right direction
Preparation of functional test report
Configure filter
Slope compensation
轉載csdn文章操作
内部字段分隔符
A few minutes before work, I found out V-model and The difference between sync
思科考试--路由的概念和配置考试
正则系列之组和范围(Groups and Ranges)
Fiori applications are shared through the enhancement of adaptation project
Understanding of indexes in MySQL
倒置残差的理解








