当前位置:网站首页>【mysql学习笔记24】索引设计原则
【mysql学习笔记24】索引设计原则
2022-06-28 14:24:00 【yqs_281876918】
1.数据量大的情况下才考虑建立索引,否则效果不明显。几w条的时候索引提升不大,到了几十w条会有提升,但也不是特别大,几百w几千w的时候用索引不用索引就是天壤之别了。
2.如果查询频次不高,不需要建立索引
3.针对查询条件针对性地建立索引
4.尽量选择区分度高的字段作为索引,如果拿性别作为字段就没啥意义了,跟全表查询没啥区别。唯一索引区分度是最高的,因为唯一索引强制字段值唯一
5.尽量用联合索引,减少单列索引,查询时尽量覆盖索引,避免回表查询
6.合理控制索引数量,索引不是越多越好,太多了会影响增删改效率。
7.如果索引列不能存储null值,请在创建表时用not null约束。当优化器知道每列是否包含null值时,它可以更好地选择索引。
边栏推荐
- Four visualization tools are recommended to solve 99% of large screen visualization projects!
- What does VPS do? What are the famous brands? What is the difference with ECS?
- Npoi export excel and download to client
- A bug liver a week I can't help mentioning issue
- A queue of two stacks
- Can your code talk? (upper)
- 2022金属非金属矿山安全检查(地下矿山)复训题库及在线模拟考试
- 木兰开放作品许可证1.0面向社会公开征求意见
- Votre Code parle? (1)
- PC博物馆-熟悉又陌生的懵懂年代
猜你喜欢

Thread life cycle and its methods

基于 Nebula Graph 构建百亿关系知识图谱实践

Jingyuan's safe sprint to the Growth Enterprise Market: it plans to raise 400million yuan for investment and Yunyou software is the shareholder

量子前沿英雄谱|“光量子探险家”McMahon:将任何物理系统变成神经网络

运行近20年,基于Win 98的火星探测器软件迎来首次升级

Rslo: self supervised lidar odometer (real time + high precision, icra2022)

坐拥755万开发者的中国开源,进度几何?

IonQ联合GE Research证实:量子计算在风险聚合上有巨大潜力

How to design data visualization platform
![[Zhongyi Xinsheng] 5 SPI interface test TF Card](/img/d9/56ded362b3055f4f0efc3ce0eec5d5.jpg)
[Zhongyi Xinsheng] 5 SPI interface test TF Card
随机推荐
Summary of 2021 computer level III database
js 判断字符串为空或者不为空
Adding virtual environments to the Jupiter notebook
机器人的运动范围(DFS)
加油站(贪心)
基于ASP的勤工俭学管理系统
Flutter series: offstage in flutter
开源社邀您参加OpenInfra Days China 2022,议题征集进行中~
求解汉诺塔问题
名创优品通过上市聆讯:寻求双重主要上市 年营收91亿
Robot range of motion (DFS)
Jingyuan's safe sprint to the Growth Enterprise Market: it plans to raise 400million yuan for investment and Yunyou software is the shareholder
Tencent was underweight again by prosus, the major shareholder: the latter also cashed out $3.7 billion from JD
Work study management system based on ASP
MySQL从库Error:“You cannot ‘Alter‘ a log table...“
How to count dimensions of foreign trade E-mail Promotion
Go array and slice, []byte to string[easy to understand]
基于MATLAB的混沌数字图像加密技术研究与仿真实现
Npoi export excel and download to client
flutter 系列之:flutter 中的 offstage