当前位置:网站首页>MySQL index optimization miscellaneous
MySQL index optimization miscellaneous
2022-06-30 09:35:00 【Tyndarus Hound】
MySQL- Index optimization paraphrase
Index push down
Index push down (Index Condition Pushdown,ICP): For auxiliary federated indexes , Normally, the leftmost prefix is used ,SELECT * FROM employees WHERE name like ‘LiLei%’ AND age = 22 AND position =‘manager’( With name,age,position Index for Federation ) This situation will only go name Field index , Because according to name After filtering the fields , In the resulting index line age and position Is chaotic , Can't make good use of indexes .
stay MySQL5.6 Previous version , This query can only match the name in the union **‘LiLei’ start ** The index of , Then take the primary keys corresponding to these indexes back to the table one by one , Find the corresponding record in the primary key index , In comparison age and position Whether the values of these two fields match .
stay MySQL5.6 Index push down optimization is introduced , During index traversal , Judge all the fields contained in the index first , Filter out the unqualified records before returning to the table , It can effectively reduce the times of returning to the table . After using index push down , According to the above query, the name matched in the union index is ‘LiLei’ After the first index , It also filters in the index age and position These two fields , Take the primary key corresponding to the filtered index id Go back to the table and check the data of Zheng hang .
Index push down will reduce the number of table returns , about innoDB The table index push down of the engine can only be used for secondary indexes ,innoDB Primary key index of ( Cluster index ) The tree leaf node stores the entire row of data , So at this time, the index push down will not have the effect of querying the whole row of data less .
Why range lookup MySQL No index push down optimization is used
It should be MySQL The result set of the range lookup filter is considered too large ,like kk% In most cases, look at , The filtered result set is relatively small , So here MySQL Choose to give like KK% Index push down optimization , Of course , It's not absolute , Have you got anything to do like KK% It doesn't necessarily lead down . Related to optimizer processing
Force Index
EXPLAIN SELECT * FROM employees force index(idx_name_age_position) WHERE name > 'LiLei' AND age = 22 A ND position ='manager';
add force index, But I haven't seen much use of it .
in and or When the amount of table data is large, the index will be used , When there are few table records, full table scanning will be selected
like KK% In general, I will go to the index
边栏推荐
- OCX child thread cannot trigger event event (forward)
- Using appbarlayout to realize secondary ceiling function
- Talking about the difference between kotlin collaboration and thread
- 7. know JNI and NDK
- Baidu map JS browsing terminal
- 8.8 heap insertion and deletion
- Dart asynchronous task
- Idea setting automatic package Guide
- QR code generation and analysis
- Differences between the notify(), notifyall(), notifydatasetchanged(), notifydatasetinvalidated() methods in the adapter
猜你喜欢

Talk about how the kotlin process started?

Talk about the kotlin cooperation process and the difference between job and supervisorjob

Agp7.0|kts makes a reinforced plug-in

MySQL优化

仿照微信Oauth2.0接入方案

Using appbarlayout to realize secondary ceiling function

Bottomsheetbehavior principle of realizing the home page effect of Gaode map

Idea shortcut key settings

桂林 稳健医疗收购桂林乳胶100%股权 填补乳胶产品线空白

Deeply understand the working principle of kotlin collaboration suspend (beginners can also understand it)
随机推荐
MySQL优化
asdsadadsad
I once met a girl whom I most wanted to take care of all my life. Later... No later
Enum demo
[wechat applet] realize applet pull-down refresh and pull-up loading
[shutter] solve failed assertion: line 5142 POS 12: '_ debugLocked‘: is not true.
Applet learning path 2 - event binding
Invalid update: invalid number of sections. The number of sections contained in the table view after
Deep Learning with Pytorch-Train A Classifier
Framework program of browser self-service terminal based on IE kernel
Esp32 things (II): sharpening the knife without mistaking firewood - make preparations before project development
I'm late for school
Do you want the dialog box that pops up from the click?
仿照微信Oauth2.0接入方案
Metasploit practice - SSH brute force cracking process
Explanation on the use of password profiteering cracking tool Hydra
Use V-IF with V-for
How do I start? (continuously updating)
UltraEdit delete empty line method
JPA naming rules