当前位置:网站首页>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
边栏推荐
- Dichotomy (integer dichotomy, real dichotomy)
- STM32 key state machine 2 - state simplification and long press function addition
- scratch疫情隔离和核酸检测模拟 电子学会图形化编程scratch等级考试三级真题和答案解析2022年6月
- 【剑指 Offer】 60. n个骰子的点数
- 关于这次通信故障,我想多说几句…
- 虚拟机VirtualBox和Vagrant安装
- Kill -9 system call used by PID to kill process
- Stealing others' vulnerability reports and selling them into sidelines, and the vulnerability reward platform gives rise to "insiders"
- It doesn't make sense without a distributed gateway
- D binding function
猜你喜欢

J'aimerais dire quelques mots de plus sur ce problème de communication...

Four processes of program operation

Grafana 9.0 正式发布!堪称最强!

C language exchanges two numbers through pointers

Pytest learning ----- pytest confitest of interface automation test Py file details

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

【.NET CORE】 请求长度过长报错解决方案

Windows connects redis installed on Linux

Kivy tutorial: support Chinese in Kivy to build cross platform applications (tutorial includes source code)

Compilation Principle -- C language implementation of prediction table
随机推荐
编译原理——自上而下分析与递归下降分析构造(笔记)
转载:基于深度学习的工业品组件缺陷检测技术
MarkDown语法——更好地写博客
2022 Summer Project Training (II)
Prophet模型的简介以及案例分析
MSF horizontal MSF port forwarding + routing table +socks5+proxychains
VR panoramic wedding helps couples record romantic and beautiful scenes
Declval of template in generic programming
Four processes of program operation
I want to say more about this communication failure
李書福為何要親自掛帥造手機?
Windows连接Linux上安装的Redis
SQL优化问题的简述
Transfer data to event object in wechat applet
DNS hijacking
推荐好用的后台管理脚手架,人人开源
F200——搭载基于模型设计的国产开源飞控系统无人机
容器里用systemctl运行服务报错:Failed to get D-Bus connection: Operation not permitted(解决方法)
微信为什么使用 SQLite 保存聊天记录?
编译原理——预测表C语言实现