当前位置:网站首页>简单描述 MySQL 中,索引,主键,唯一索引,联合索引 的区别,对数据库的性能有什么影响(从读写两方面)
简单描述 MySQL 中,索引,主键,唯一索引,联合索引 的区别,对数据库的性能有什么影响(从读写两方面)
2022-07-06 06:41:00 【辰风沐阳】
1. 前言
简单描述 MySQL 中,索引,主键,唯一索引,联合索引 的区别,对数据库的性能有什么影响(从读写两方面)
这是一道非常经典的 MySQL 索引面试题,意在看面试者是否了解索引的几种类型以及索引的优点和存在的弊端
2. 几种索引类型的区别
索引是帮助数据库高效获取数据的一种数据结构,索引文件中记录着对数据表数据的引用指针
主键是一种特殊的唯一索引,在一张表中只能有一个主键索引,主键索引用于唯一标识一条记录
唯一索引用于确保某一列只包含各不相同的值,也就是说,唯一索引可以保证数据记录的唯一性
联合索引是指通过多个列建立的索引,比如有: 联合主键索引,联合唯一索引
3. 索引读写方面对数据库性能的影响
读: 索引可以极大的提高数据查询速度,建立索引后会生成索引文件,所以本质上索引是以空间换时间。
写: 索引会降低插入,删除,更新的速度,是因为当数据发生改变后,会重新建立索引,那么就会重新构建索引文件,导致增删改操作变慢
边栏推荐
- Chapter 7 - thread pool of shared model
- Facebook AI & Oxford proposed a video transformer with "track attention" to perform SOTA in video action recognition tasks
- 成功解决TypeError: data type ‘category‘ not understood
- Fledgling Xiao Li's 103rd blog CC2530 resource introduction
- Pallet management in SAP SD delivery process
- CS-证书指纹修改
- The internationalization of domestic games is inseparable from professional translation companies
- 翻译生物医学说明书,英译中怎样效果佳
- [Yu Yue education] flower cultivation reference materials of Weifang Vocational College
- AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models.common‘ from ‘/home/yolov5/models/comm
猜你喜欢
Leetcode daily question (971. flip binary tree to match preorder traversal)
Chapter 7 - thread pool of shared model
MySQL5.72.msi安装失败
Simple use of MySQL database: add, delete, modify and query
mysql的基础命令
Today's summer solstice
如何做好金融文献翻译?
基于PyTorch和Fast RCNN快速实现目标识别
红蓝对抗之流量加密(Openssl加密传输、MSF流量加密、CS修改profile进行流量加密)
In English translation of papers, how to do a good translation?
随机推荐
Suspended else
ROS2安装及基础知识介绍
Automated test environment configuration
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Redis Foundation
论文翻译英译中,怎样做翻译效果好?
翻译公司证件盖章的价格是多少
金融德语翻译,北京专业的翻译公司
Fledgling Xiao Li's 103rd blog CC2530 resource introduction
How to translate biomedical instructions in English
成功解决TypeError: data type ‘category‘ not understood
Pallet management in SAP SD delivery process
如何做好互联网金融的英语翻译
同事上了个厕所,我帮产品妹子轻松完成BI数据产品顺便得到奶茶奖励
医疗软件检测机构怎么找,一航软件测评是专家
Chinese English comparison: you can do this Best of luck
Difference between backtracking and recursion
生物医学本地化翻译服务
How to reconstruct the class explosion caused by m*n strategies?
Classification des verbes reconstruits grammaticalement - - English Rabbit Learning notes (2)