当前位置:网站首页>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
边栏推荐
- 2019 Alibaba cluster dataset Usage Summary
- UDP protocol: simple because of good nature, it is inevitable to encounter "city can play"
- 8位MCU跑RTOS有没有意义?
- 1700C - Helping the Nature
- std::true_ Type and std:: false_ type
- 面向程序员的精品开源字体
- node の SQLite
- Compilation Principle -- C language implementation of prediction table
- Kivy tutorial: support Chinese in Kivy to build cross platform applications (tutorial includes source code)
- Implementation of queue
猜你喜欢
![Jerry's updated equipment resource document [chapter]](/img/6c/17bd69b34c7b1bae32604977f6bc48.jpg)
Jerry's updated equipment resource document [chapter]

FMT open source self driving instrument | FMT middleware: a high real-time distributed log module Mlog

Declval of template in generic programming

Maixll-Dock 摄像头使用

【Swoole系列2.1】先把Swoole跑起来

简单易用的PDF转SVG程序

F200——搭载基于模型设计的国产开源飞控系统无人机

30 分钟看懂 PCA 主成分分析

微信为什么使用 SQLite 保存聊天记录?

第三季百度网盘AI大赛盛夏来袭,寻找热爱AI的你!
随机推荐
F200——搭载基于模型设计的国产开源飞控系统无人机
Interview shock 62: what are the precautions for group by?
Olivetin can safely run shell commands on Web pages (Part 1)
Jerry's updated equipment resource document [chapter]
d绑定函数
std::true_ Type and std:: false_ type
Introduction to the usage of model view delegate principal-agent mechanism in QT
The easycvr platform reports an error "ID cannot be empty" through the interface editing channel. What is the reason?
趣-关于undefined的问题
Distinguish between basic disk and dynamic disk RAID disk redundant array
Appium automated test scroll and drag_ and_ Drop slides according to element position
Transfer data to event object in wechat applet
Manifest of SAP ui5 framework json
1700C - Helping the Nature
开源与安全的“冰与火之歌”
Compilation Principle -- C language implementation of prediction table
关于这次通信故障,我想多说几句…
Kivy tutorial: support Chinese in Kivy to build cross platform applications (tutorial includes source code)
Jerry is the custom background specified by the currently used dial enable [chapter]
Take you through ancient Rome, the meta universe bus is coming # Invisible Cities