当前位置:网站首页>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
边栏推荐
- 【.NET CORE】 请求长度过长报错解决方案
- How to solve the error "press any to exit" when deploying multiple easycvr on one server?
- QT中Model-View-Delegate委托代理机制用法介绍
- D binding function
- Getting started with pytest ----- test case pre post, firmware
- STM32按键状态机2——状态简化与增加长按功能
- Is it meaningful for 8-bit MCU to run RTOS?
- Cool Lehman has a variety of AI digital human images to create a vr virtual exhibition hall with a sense of technology
- Video fusion cloud platform easycvr adds multi-level grouping, which can flexibly manage access devices
- 《ASP.NET Core 6框架揭秘》样章发布[200页/5章]
猜你喜欢

Recursive way

30 minutes to understand PCA principal component analysis

简单易用的PDF转SVG程序

Pytest learning ----- detailed explanation of the request for interface automation test

Pytest learning ----- pytest operation mode and pre post packaging of interface automation testing

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

從交互模型中蒸餾知識!中科大&美團提出VIRT,兼具雙塔模型的效率和交互模型的性能,在文本匹配上實現性能和效率的平衡!...

Declval of template in generic programming

Windows connects redis installed on Linux

历史上的今天:Google 之母出生;同一天诞生的两位图灵奖先驱
随机推荐
Five data structures of redis
Is it meaningful for 8-bit MCU to run RTOS?
容器里用systemctl运行服务报错:Failed to get D-Bus connection: Operation not permitted(解决方法)
《ASP.NET Core 6框架揭秘》样章发布[200页/5章]
node の SQLite
虚拟机VirtualBox和Vagrant安装
IP, subnet mask, gateway, default gateway
Insert dial file of Jerry's watch [chapter]
转载:基于深度学习的工业品组件缺陷检测技术
Jerry's setting currently uses the dial. Switch the dial through this function [chapter]
关于这次通信故障,我想多说几句…
The integrated real-time HTAP database stonedb, how to replace MySQL and achieve nearly a hundredfold performance improvement
李書福為何要親自掛帥造手機?
The difference between parallelism and concurrency
Smart street lamp based on stm32+ Huawei cloud IOT design
Dichotomy (integer dichotomy, real dichotomy)
带你穿越古罗马,元宇宙巴士来啦 #Invisible Cities
30 分钟看懂 PCA 主成分分析
Pytest learning ----- pytest operation mode and pre post packaging of interface automation testing
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