当前位置:网站首页>Brief description of SQL optimization problems
Brief description of SQL optimization problems
2022-07-06 18:15:00 【Programming for Hongmeng】
SQL Optimization of the 7 In terms of
- Create index
- Avoid index invalidation
- Lock granularity ( Row lock or watch lock )
- Paging query optimization
- Avoid querying all fields
- analysis SQL Implementation plan of
- show profile analysis SQL Execution performance
Create index
- It is forbidden to create a separate index for each column in a table
- Every Innodb Table must have a primary key
- Pay attention to the field order of the combined index
- Override index first
- Avoid using foreign key constraints
Avoid index invalidation ( Failure scenario )
- With % At the beginning LIKE Inquire about
- Operations on index columns , function upper() etc. ,or、!=、<>、not in wait
- Composite index created , But the query conditions are not satisfied “ The leftmost match ” principle
- Use... In query conditions or, And or There is no condition in the index before and after , Then the indexes involved will not be used
Lock granularity ( Row lock still Table locks )
- MySQL Our storage engines fall into two broad categories : MyISAM and InnoDB
- MyISAM Only supported Table locks
- InnoDB Support Row lock and Table locks
- update operation when , In order to ensure the accuracy of table data , Usually Lock , In order to improve the high concurrency of the system , We usually recommend Row lock , Reduce lock conflicts 、 Lock wait time . therefore , Storage engines usually choose InnoDB
Paging query optimization
Avoid querying all fields
analysis SQL Implementation plan of
show profile analysis SQL Execution performance
The follow-up will gradually improve ... Make a point in this chapter first
边栏推荐
- 历史上的今天:Google 之母出生;同一天诞生的两位图灵奖先驱
- What is the reason why the video cannot be played normally after the easycvr access device turns on the audio?
- Windows连接Linux上安装的Redis
- Excel usage record
- 2022 Summer Project Training (I)
- C语言自动预订飞机票问题
- Interview shock 62: what are the precautions for group by?
- Declval (example of return value of guidance function)
- MSF horizontal MSF port forwarding + routing table +socks5+proxychains
- declval(指导函数返回值范例)
猜你喜欢

阿里云国际版ECS云服务器无法登录宝塔面板控制台

2019 Alibaba cluster dataset Usage Summary

Selected technical experts from China Mobile, ant, SF, and Xingsheng will show you the guarantee of architecture stability

李书福为何要亲自挂帅造手机?

从交互模型中蒸馏知识!中科大&美团提出VIRT,兼具双塔模型的效率和交互模型的性能,在文本匹配上实现性能和效率的平衡!...

Rb157-asemi rectifier bridge RB157

node の SQLite

The integrated real-time HTAP database stonedb, how to replace MySQL and achieve nearly a hundredfold performance improvement

OliveTin能在网页上安全运行shell命令(上)

Four processes of program operation
随机推荐
[Android] kotlin code writing standardization document
Is it meaningful for 8-bit MCU to run RTOS?
Jielizhi obtains the currently used dial information [chapter]
The difference between parallelism and concurrency
传输层 拥塞控制-慢开始和拥塞避免 快重传 快恢复
Compilation Principle -- C language implementation of prediction table
Four processes of program operation
Video fusion cloud platform easycvr adds multi-level grouping, which can flexibly manage access devices
Pytest learning ----- pytest confitest of interface automation test Py file details
Open source and safe "song of ice and fire"
2022 Summer Project Training (III)
Selected technical experts from China Mobile, ant, SF, and Xingsheng will show you the guarantee of architecture stability
8位MCU跑RTOS有没有意义?
队列的实现
30 minutes to understand PCA principal component analysis
I want to say more about this communication failure
推荐好用的后台管理脚手架,人人开源
2022暑期项目实训(一)
There is a gap in traditional home decoration. VR panoramic home decoration allows you to experience the completion effect of your new house
Fleet tutorial 13 basic introduction to listview's most commonly used scroll controls (tutorial includes source code)