当前位置:网站首页>[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 ;
边栏推荐
- Understanding of transactions in MySQL
- SAP UI5 应用开发教程之一百零四 - SAP UI5 表格控件的支持复选(Multi-Select)以及如何用代码一次选中多个表格行项目
- 2020-ViT ICLR
- QStringList 的常规使用
- nn.Parameter】Pytorch特征融合自适应权重设置(可学习权重使用)
- Selection of all-optical technology in the park - Part 2
- 多图预警~ 华为 ECS 与 阿里云 ECS 对比实战
- Appium automation test foundation - appium installation (I)
- 第三方验收测试有什么好处?专业第三方软件测试机构推荐
- 利用SecureCRTPortable远程连接虚拟机
猜你喜欢
"Trust machine" empowers development
Deadlock handling strategies - prevent deadlock, avoid deadlock, detect and remove deadlock
FFMpeg学习笔记
Delete AWS bound credit card account
The median salary of TSMC's global employees is about 460000, and the CEO is about 8.99 million; Apple raised the price of iPhone in Japan; VIM 9.0 release | geek headlines
Stimulate new kinetic energy and promote digital economy in multiple places
How to write a performance test plan
好友新书发布,祝贺(送福利)
Appium自动化测试基础 — 补充:Desired Capabilities参数介绍
Chen Tianqi's machine learning compilation course (free)
随机推荐
陈天奇的机器学习编译课(免费)
【QT小作】封装一个简单的线程管理类
【日常训练】326. 3 的幂
Kubernetes create service access pod
人体姿态估计的热图变成坐标点的两种方案
QStringList 的常规使用
Deep learning -- data operation
[untitled]
第三方验收测试有什么好处?专业第三方软件测试机构推荐
104. SAP ui5 table control supports multi select and how to select multiple table row items at a time with code
利用SecureCRTPortable远程连接虚拟机
多图预警~ 华为 ECS 与 阿里云 ECS 对比实战
Wechat open platform scanning code login [easy to understand]
nn. Parameter] pytoch feature fusion adaptive weight setting (learnable weight use)
思科考试--路由的概念和配置考试
There is no signal in HDMI in computer games caused by memory, so it crashes
Measurement of reference loop gain and phase margin
Tourism Management System
mixconv代码
cvpr2022 human pose estiamtion