当前位置:网站首页>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;
边栏推荐
猜你喜欢

LED flashing on CY7C68013A

SQL 入门之第一讲——MySQL 8.0.29安装教程(windows 64位)

Small application project development, jingdong mall 】 【 uni - app custom search component (below) - search history

【小程序专栏】总结uniapp开发小程序的开发规范

《c语言小游戏》入门级三子棋游戏(机器人加强版)

shell/bash脚本命令教程

【面试题】从输入URL到游览器渲染完成,经历了什么
![[Cloud native] Introduction and use of Feign of microservices](/img/39/05cf7673155954c90e75a8a2eecd96.jpg)
[Cloud native] Introduction and use of Feign of microservices

0730~Mysql优化

Vscode:Project-tree插件
随机推荐
Practical Bioinformatics 2: Multi-omics data integration and mining
ZCMU--1862: zbj的狼人杀
WLAN部署(AC+AP)配置及常见问题记录
The first part of the R language
《C语言小游戏》扫雷
波士顿房价数据集 Boston house prices dataset
【MySQL中auto_increment有什么作用?】
48页智慧城市规划蓝图 解决方案
[Interview: Concurrency 38: Multithreading: Thread Pool] Basic concepts of the ThreadPoolExecutor class
Vscode: Project-tree plugin
linux redis6.2.6配置文件
初识NK-RTU980开发板
SSM整合案例分析(详解)
Spark 在 Yarn 上运行 Spark 应用程序
tqdm库的使用
科目三:前方路口直行
[PSQL] Complex query
35-Jenkins-Shared library application
"C language game" entry-level chess game (robot enhanced version)
蚂蚁核心科技产品亮相数字中国建设峰会 持续助力企业数字化转型