当前位置:网站首页>0730~Mysql optimization
0730~Mysql optimization
2022-07-31 08:32:00 【Life is so hard】
Common reasons for index failure?
1. Use select*
2. There is no guarantee of the leftmost prefix principle
3. Do not add % to the left side of fuzzy query like -- solution covering index query
4.or improper use of keywords -- solution Use union to solve
5. There can be no calculation in the query condition
6. Functions cannot be used in query conditions
7.order by grouping order and set index are inconsistent, it will also fail
8.varchar type without single quotes
9. Use is null or is not null -- if the set property cannot be empty, then the index will not be taken,
If the set property can be empty, then is null will go to the index, is not null will not go to the index;
When executing the plan with EXPLAIN, mainly check the following fields
type: The type of query, at least ref, All is the worst case;
key: see which indexes are actually hit;
rows: look at the number of query queries;
Extra: Mainly see UsingWhere means filter with where condition;
边栏推荐
猜你喜欢
随机推荐
[Interview: Concurrency 37: Multithreading: Thread Pool] Custom Thread Pool
【小程序项目开发-- 京东商城】uni-app之自定义搜索组件(下) -- 搜索历史
一文搞定代码中的命名
MySQL 5.7升级到8.0详细过程
如何在一台机器上(windows)安装两个MYSQL数据库
Failure scenarios of @Transactional annotations
关于@Autowired
Pygame Surface对象
[Yellow ah code] Introduction to MySQL - 3. I use select, the boss directly drives me to take the train home, and I still buy a station ticket
中软国际携手深开鸿发布(1+1) x N 战略,以数字化、智慧化改变人类生产和生活方式
MySQL安装教程
Vscode:Project-tree插件
波士顿房价数据集 Boston house prices dataset
免安装版的Mysql安装与配置——详细教程
关于“算力”,这篇文章值得一看
《C语言小游戏》扫雷
[What is the role of auto_increment in MySQL?】
日志导致线程Block的这些坑,你不得不防
【面试题】从输入URL到游览器渲染完成,经历了什么
【小程序项目开发 -- 京东商城】uni-app 商品分类页面(下)