当前位置:网站首页>[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 ;
边栏推荐
- 【日常训练】66. 加一
- Flynk SQL client uses comparison and is familiar with official documents
- 业务可视化-让你的流程图'Run'起来
- MySQL -- index of MyISAM storage engine
- rxjs Observable of 操作符的单步调试分析
- What class loading mechanisms does the JVM have?
- Intelligent computing architecture design of Internet
- Two schemes of transforming the heat map of human posture estimation into coordinate points
- Turn -- bring it and use it: share a gadget for checking memory leaks
- Arlo's thinking after confusion
猜你喜欢

Réimpression de l'article csdn

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

Yolov5.5 call local camera

Sogou wechat app reverse (II) so layer

Understanding of transactions in MySQL

Vsphere+ and vsan+ are coming! VMware hybrid cloud focus: native, fast migration, mixed load

Configure filter

Appium自动化测试基础 — APPium安装(一)

数字货币:影响深远的创新

SAP ui5 application development tutorial 104 - multi select support for SAP ui5 table controls and how to use code to select multiple table row items at a time
随机推荐
思科--WAN 的概念考试外部工具
Cloud Vulnerability Global Database
General use of qstringlist
Explain kubernetes network model in detail
A few minutes before work, I found out V-model and The difference between sync
rxjs Observable of 操作符的单步调试分析
map容器
Quantifiers of regular series
2020-ViT ICLR
El input text field word limit, beyond which the display turns red and input is prohibited
【QT小作】封装一个简单的线程管理类
There is no signal in HDMI in computer games caused by memory, so it crashes
104. SAP ui5 table control supports multi select and how to select multiple table row items at a time with code
LC501. Mode in binary search tree
SAP intelligent robot process automation (IRPA) solution sharing
ECMAScript 2022 正式发布,有你了解过的吗?
el-input文本域字数限制,超过显示变红并禁止输入
聊一聊Zabbix都监控哪些参数
Deadlock handling strategies - prevent deadlock, avoid deadlock, detect and remove deadlock
Efficiency improvement - encourage personalized container development environment