当前位置:网站首页>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
边栏推荐
- Excel usage record
- 2022 Summer Project Training (I)
- 【Swoole系列2.1】先把Swoole跑起来
- Ms-tct: INRIA & SBU proposed a multi-scale time transformer for motion detection. The effect is SOTA! Open source! (CVPR2022)...
- Insert dial file of Jerry's watch [chapter]
- F200 - UAV equipped with domestic open source flight control system based on Model Design
- Jerry's updated equipment resource document [chapter]
- 高精度运算
- 2022暑期项目实训(三)
- Is it meaningful for 8-bit MCU to run RTOS?
猜你喜欢
Grafana 9.0 正式发布!堪称最强!
Ms-tct: INRIA & SBU proposed a multi-scale time transformer for motion detection. The effect is SOTA! Open source! (CVPR2022)...
Introduction to the usage of model view delegate principal-agent mechanism in QT
Video fusion cloud platform easycvr adds multi-level grouping, which can flexibly manage access devices
开源与安全的“冰与火之歌”
Distiller les connaissances du modèle interactif! L'Université de technologie de Chine & meituan propose Virt, qui a à la fois l'efficacité du modèle à deux tours et la performance du modèle interacti
Is it meaningful for 8-bit MCU to run RTOS?
C语言通过指针交换两个数
8位MCU跑RTOS有没有意义?
Compilation Principle -- C language implementation of prediction table
随机推荐
2022 Summer Project Training (II)
Interview assault 63: how to remove duplication in MySQL?
Four processes of program operation
std::true_type和std::false_type
Jerry's access to additional information on the dial [article]
TCP packet sticking problem
转载:基于深度学习的工业品组件缺陷检测技术
RB157-ASEMI整流桥RB157
重磅!蚂蚁开源可信隐私计算框架“隐语”,主流技术灵活组装、开发者友好分层设计...
【剑指 Offer】 60. n个骰子的点数
FMT开源自驾仪 | FMT中间件:一种高实时的分布式日志模块Mlog
The easycvr authorization expiration page cannot be logged in. How to solve it?
Dichotomy (integer dichotomy, real dichotomy)
Pytest learning ----- detailed explanation of the request for interface automation test
It doesn't make sense without a distributed gateway
SQL statement optimization, order by desc speed optimization
Maixll-Dock 摄像头使用
Recommend easy-to-use backstage management scaffolding, everyone open source
Jerry's watch reads the file through the file name [chapter]
第三季百度网盘AI大赛盛夏来袭,寻找热爱AI的你!