当前位置:网站首页>MySQL index
MySQL index
2022-06-13 00:56:00 【-LM-】
Indexes
Quickly find data structures in order
Point to data as a pointer
Index method :

Concept
Beyond the data itself , The database also maintains a data structure that satisfies a specific search algorithm , These data structures point to data in some way , In this way, advanced search algorithms can be realized on the basis of these data structures , This data structure is the index .
Advantages and disadvantages
advantage :
- Improve the efficiency of data retrieval , Reduce the IO cost
- Reduce the sorting cost of data , To reduce the CPU Consumption of
Inferiority :
- Occupancy space
- Reduce the update speed of the table
- Indexing takes time
classification
Single value index
An index contains only a single column , A table can have multiple single-column indexes
The maximum number of indexes for a table should not exceed 5 individual
unique index
The value of the index column must be unique , But you can have an empty value
Composite index
An index contains multiple columns
Basic grammar

Index structure
- BTree Indexes
- Hash Indexes
- full-text Full-text index
- R-Tree Indexes
Suitable for indexing
- Primary key automatically creates unique index
- Fields that are frequently used as query criteria should be indexed
- Fields associated with other tables in the query , Index foreign key relationship
- Frequently updated fields are not suitable for index creation ( Updating requires not only updating the data but also updating the index )
- WHERE Fields that cannot be used by the condition are not indexed
- Single key / The choice of Composite Index , High and low tendency to create composite index
- Fields sorted in the query , If the sorting field is accessed by index, the sorting speed will be greatly improved
- Statistics or grouping fields in query
Not suitable for indexing
- There are too few records
- Often add, delete, or alter tables
- Duplicate and evenly distributed table fields
边栏推荐
- How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of strategic returns of vrsi, bbiboll, WR, bias and RSI indicators
- [imx6ull] video monitoring project (USB camera +ffmepeg)
- Druid reports an error connection holder is null
- 牌好不好无法预料
- Andersen global expands its business in northern Europe through cooperation agreements in Finland and Denmark
- [JS component] customize the right-click menu
- Physical orbit simulation
- Kotlin coroutine withcontext switch thread
- Four startup modes of kotlin collaboration
- Liu Hui and introduction to nine chapter arithmetic and island arithmetic
猜你喜欢

深度学习每周期的步数多少合适?
![[buglist] serial port programming does not read data](/img/bf/8e63f679bf139fbbf222878792ae21.jpg)
[buglist] serial port programming does not read data

Four startup modes of kotlin collaboration

pytorch和tensorflow有什么区别?

How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of DBCD, ROC, vroc, Cr and psy index strategy income

MySQL queries the quantity of each month and the year-on-year and month on month data of each month
![[JS component] calendar](/img/20/71bb0c59da29b3cd3418e38cca39c0.jpg)
[JS component] calendar

Cards are unpredictable

Common skills for quantitative investment - drawing 2: drawing the moving average

Binary tree - right view
随机推荐
Antdpro - protable realizes the linkage effect of two selection boxes
Kotlin 协程的四种启动模式
【北亚服务器数据恢复】虚拟机文件丢失导致Hyper-V服务瘫痪的数据恢复案例
草在结种子了
[network protocol] problems and solutions in the use of LwIP
Sequence table - find main element
Opencv desaturation
Canvas airplane game
How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of strategic returns of vrsi, bbiboll, WR, bias and RSI indicators
牌好不好无法预料
Android Weather
Binary tree - right view
[JS component] dazzle radio box and multi box
Comparison of disk partition modes (MBR and GPT)
Expression tree - medium order printout
pytorch是什么?解释pytorch的基本概念
蓝桥杯单片机第七届决赛
The grass is bearing seeds
Three column simple Typecho theme lanstar/ Blue Star Typecho theme
Druid reports an error connection holder is null