当前位置:网站首页>[MySQL learning notes 22] index
[MySQL learning notes 22] index
2022-06-25 09:38:00 【yqs_ two hundred and eighty-one million eight hundred and seven】
Advantages and disadvantages
| advantage | Inferiority |
|---|---|
| Improve the efficiency of data retrieval , Reduce the io cost | The index column takes up space |
| Sort data by indexing Columns , Reduce the cost of sorting data , Reduce CPU Consumption of | Indexing greatly improves query efficiency , It also reduces the efficiency of updating tables , Because you need to update the index while updating the table |
Index structure
| Index structure | describe |
|---|---|
| B+Tree Indexes ( Default ) | The most common type of index , Most engines support |
| Hash Indexes | The underlying principle is the hash table , Range query is not supported , Can only match exactly |
| R-Tree | Commonly used for geospatial data types |
| Full-text( Full-text index ) | It's a way of building inverted indexes , How to quickly match documents |
Each engine supports indexing

Index classification
| classification | meaning | characteristic | keyword |
|---|---|---|---|
| primary key | The index created for the primary key in the table | Automatically created by default , There can only be one | PRIMARY |
| unique index | Avoid a column with duplicate values | There can be multiple | UNIQUE, You can specify when creating a table , It can also be added manually later |
| General index | Quickly locate data | There can be multiple | nothing , You need to create... Manually |
| Full-text index | Fast Text Retrieval | There can be multiple | FULLTEXT |
expand : The uniqueness of column value depends on the unique index .
| classification | meaning | characteristic |
|---|---|---|
| Clustered index | Put data storage and storage together , The leaf node of the index structure holds the row data | There has to be , And there is only one , When creating a table, the primary key is automatically used as a clustered index , If there is no primary key , Use the first unique index as the clustered index , If not ,InnoDB Will automatically a hidden rowid As a clustered index |
| Secondary indexes | Separate data from index , The leaf node of the index structure stores the corresponding primary key | There can be multiple |
example

Such as execution select * from user where name =‘Arm’;
Then we'll go first name Search in the index Arm, Query to Arm The corresponding id yes 10, Then I'll take this 10 Go to the clustered index to find specific data , Then return . This process is called “ Return to the table for query ”.
Create index
create [unique|fulltext] index index_name on table_name (index_col_name1,…);
Look at the index
show index from table_name;
Delete index
drop index index_name on table_name;
边栏推荐
- sklearn 高维数据集制作make_circles 和 make_moons
- Pytorch_Geometric(PyG)使用DataLoader报错RuntimeError: Sizes of tensors must match except in dimension 0.
- Test Development Engineer
- [zero foundation understanding innovation and entrepreneurship competition] overall cognition and introduction of mass entrepreneurship and innovation competition (including FAQs and integration of bl
- Simple waterfall effect
- Huipay international permet au commerce électronique transfrontalier de devenir une plate - forme de paiement transfrontalière conforme!
- Online notes on Mathematics for postgraduate entrance examination (9): a series of courses on probability theory and mathematical statistics
- 请问在手机上开户股票,还是去证券公司开户安全?
- Abbreviations of common English terms for IC R & D
- 匯付國際為跨境電商賦能:做合規的跨境支付平臺!
猜你喜欢

Data-driven anomaly detection and early warning of item C in the May 1st mathematical modeling competition in 2021

sklearn 高维数据集制作make_circles 和 make_moons

Matplotlib plt Axis() usage

行业春寒回暖,持续承压的酒店企业于何处破局?

Applet cloud development joint table data query and application in cloud function
![[buuctf.reverse] 117-120](/img/6c/8a90fff2bd46f1494a9bd9c77eeafc.png)
[buuctf.reverse] 117-120

With the QQ group file storage function of super nice, you immediately have n cloud disks that are easy to download and never expire

Question B of the East China Cup: how to establish a population immune barrier against novel coronavirus?

【mysql学习笔记22】索引

Analysis on the bottom calling process of micro service calling component ribbon
随机推荐
Online notes on Mathematics for postgraduate entrance examination (9): a series of courses on probability theory and mathematical statistics
vscode试图过程写入管道不存在
行业春寒回暖,持续承压的酒店企业于何处破局?
2021mathorcupc topic optimal design of heat dissipation for submarine data center
[opencv] - input and output XML and yaml files
[zero foundation understanding innovation and entrepreneurship competition] overall cognition and introduction of mass entrepreneurship and innovation competition (including FAQs and integration of bl
在指南针上面开股票账户好不好,安不安全?
Is the client that gets the scanning code wechat or Alipay
Is it safe to open a stock account on the compass?
Benefits and types of cloud network technology
Study on correlation of pumpkin price and design of price prediction model based on BP neural network
Match a mobile number from a large number of mobile numbers
Reasons for Meiye to choose membership system
How much money have I made by sticking to fixed investment for 3 years?
Work of the 15th week
Solution to the problem of repeated startup of esp8266
Is it safe to open an account with Great Wall Securities by mobile phone?
8、智慧交通项目(1)
PHP obtains the IP address, and the apache2 server runs without error
Numpy numpy中的meshgrid()函数