当前位置:网站首页>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
边栏推荐
- Windows连接Linux上安装的Redis
- 偷窃他人漏洞报告变卖成副业,漏洞赏金平台出“内鬼”
- Scratch epidemic isolation and nucleic acid detection Analog Electronics Society graphical programming scratch grade examination level 3 true questions and answers analysis June 2022
- 编译原理——预测表C语言实现
- 最新财报发布+天猫618双榜第一,耐克蓄力领跑下个50年
- Jerry's watch deletes the existing dial file [chapter]
- Nodejs 开发者路线图 2022 零基础学习指南
- Interview shock 62: what are the precautions for group by?
- Codeforces Round #803 (Div. 2)
- std::true_type和std::false_type
猜你喜欢
面向程序员的精品开源字体
OliveTin能在网页上安全运行shell命令(上)
node の SQLite
scratch疫情隔离和核酸检测模拟 电子学会图形化编程scratch等级考试三级真题和答案解析2022年6月
[swoole series 2.1] run the swoole first
STM32按键状态机2——状态简化与增加长按功能
Interesting - questions about undefined
编译原理——自上而下分析与递归下降分析构造(笔记)
MS-TCT:Inria&SBU提出用于动作检测的多尺度时间Transformer,效果SOTA!已开源!(CVPR2022)...
Stealing others' vulnerability reports and selling them into sidelines, and the vulnerability reward platform gives rise to "insiders"
随机推荐
Five data structures of redis
Transfer data to event object in wechat applet
带你穿越古罗马,元宇宙巴士来啦 #Invisible Cities
Grafana 9.0 正式发布!堪称最强!
I want to say more about this communication failure
Getting started with pytest ----- test case pre post, firmware
J'aimerais dire quelques mots de plus sur ce problème de communication...
偷窃他人漏洞报告变卖成副业,漏洞赏金平台出“内鬼”
高精度运算
1700C - Helping the Nature
The latest financial report release + tmall 618 double top, Nike energy leads the next 50 years
《ASP.NET Core 6框架揭秘》样章发布[200页/5章]
Pytest learning ----- detailed explanation of the request for interface automation test
TCP packet sticking problem
Rb157-asemi rectifier bridge RB157
2022暑期项目实训(三)
二分(整数二分、实数二分)
Appium automated test scroll and drag_ and_ Drop slides according to element position
Compilation principle - top-down analysis and recursive descent analysis construction (notes)
2019 Alibaba cluster dataset Usage Summary