当前位置:网站首页>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
边栏推荐
- Jerry's watch reads the file through the file name [chapter]
- Redis的五种数据结构
- SQL statement optimization, order by desc speed optimization
- STM32按键状态机2——状态简化与增加长按功能
- Pytest learning ----- pytest operation mode and pre post packaging of interface automation testing
- [Android] kotlin code writing standardization document
- adb常用命令
- 关于这次通信故障,我想多说几句…
- 《ASP.NET Core 6框架揭秘》样章发布[200页/5章]
- Transfer data to event object in wechat applet
猜你喜欢

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

模板于泛型编程之declval

TOP命令详解

Getting started with pytest ----- test case pre post, firmware

Maixll-Dock 摄像头使用
![Jerry's access to additional information on the dial [article]](/img/a1/28b2a5f7c16cbcde1625a796f0d188.jpg)
Jerry's access to additional information on the dial [article]

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

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

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

Cool Lehman has a variety of AI digital human images to create a vr virtual exhibition hall with a sense of technology
随机推荐
Flet教程之 13 ListView最常用的滚动控件 基础入门(教程含源码)
關於這次通信故障,我想多說幾句…
关于这次通信故障,我想多说几句…
Transport layer congestion control - slow start and congestion avoidance, fast retransmission, fast recovery
队列的实现
Release of the sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
Rb157-asemi rectifier bridge RB157
2022 Summer Project Training (I)
Comparative examples of C language pointers *p++, * (p++), * ++p, * (++p), (*p) + +, +(*p)
Grafana 9.0 正式发布!堪称最强!
偷窃他人漏洞报告变卖成副业,漏洞赏金平台出“内鬼”
F200 - UAV equipped with domestic open source flight control system based on Model Design
Prophet模型的简介以及案例分析
转载:基于深度学习的工业品组件缺陷检测技术
Is it meaningful for 8-bit MCU to run RTOS?
二分(整数二分、实数二分)
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
Distill knowledge from the interaction model! China University of science and Technology & meituan proposed virt, which combines the efficiency of the two tower model and the performance of the intera
C语言高校实验室预约登记系统
node の SQLite