当前位置:网站首页>【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值时,它可以更好地选择索引。
边栏推荐
- Dry goods | how to calculate the KPI of scientific researchers, and what are the h index and G index
- 华泰证券开户有什么后果 怎么办理开户最安全
- Cat dog queue
- How to handle the safest account opening with Huatai Securities app
- 猫狗队列
- Leetcode(406)——根据身高重建队列
- flutter 系列之:flutter 中的 offstage
- GPS数据格式的分析与处理[通俗易懂]
- Tencent was underweight again by prosus, the major shareholder: the latter also cashed out $3.7 billion from JD
- Navicat Premium 16 永久破解激活工具及安装教程(亲测可用)
猜你喜欢

从小小线虫谈起——溯源神经系统进化,开启生命模拟

A bug liver a week I can't help mentioning issue

Can your code talk? (upper)

Opengauss kernel: analysis of SQL parsing process

What is the progress of China open source with 7.55 million developers?

外贸SEO 站长工具

Euler equation: a truly perfect formula in the history of mathematics!

PC Museum - familiar and strange ignorant age

Foreign trade SEO Webmaster Tools

线程的生命周期以及其中的方法
随机推荐
openGauss内核:SQL解析过程分析
Rails进阶——框架理论认知与构建方案建设(一)
2022金属非金属矿山安全检查(地下矿山)复训题库及在线模拟考试
单一职责原则
你的代碼會說話嗎?(上)
开闭原则
运行近20年,基于Win 98的火星探测器软件迎来首次升级
3. Overall UI architecture of the project
Gas station (greedy)
Jingyuan's safe sprint to the Growth Enterprise Market: it plans to raise 400million yuan for investment and Yunyou software is the shareholder
Double buffer drawing
SPI interface introduction -piyu dhaker
G: maximum flow problem
A queue of two stacks
2022 operation of simulation test platform for 100 simulated questions of main principals of metal and nonmetal mines (underground mines)
Four methods of thread termination
sort
验证回文串
开源社邀您参加OpenInfra Days China 2022,议题征集进行中~
[binary tree] the minimum string starting from the leaf node