当前位置:网站首页>简单描述 MySQL 中,索引,主键,唯一索引,联合索引 的区别,对数据库的性能有什么影响(从读写两方面)
简单描述 MySQL 中,索引,主键,唯一索引,联合索引 的区别,对数据库的性能有什么影响(从读写两方面)
2022-07-06 06:41:00 【辰风沐阳】
1. 前言
简单描述 MySQL 中,索引,主键,唯一索引,联合索引 的区别,对数据库的性能有什么影响(从读写两方面)
这是一道非常经典的 MySQL 索引面试题,意在看面试者是否了解索引的几种类型以及索引的优点和存在的弊端
2. 几种索引类型的区别
索引是帮助数据库高效获取数据的一种数据结构,索引文件中记录着对数据表数据的引用指针
主键是一种特殊的唯一索引,在一张表中只能有一个主键索引,主键索引用于唯一标识一条记录
唯一索引用于确保某一列只包含各不相同的值,也就是说,唯一索引可以保证数据记录的唯一性
联合索引是指通过多个列建立的索引,比如有: 联合主键索引,联合唯一索引
3. 索引读写方面对数据库性能的影响
读: 索引可以极大的提高数据查询速度,建立索引后会生成索引文件,所以本质上索引是以空间换时间。
写: 索引会降低插入,删除,更新的速度,是因为当数据发生改变后,会重新建立索引,那么就会重新构建索引文件,导致增删改操作变慢
边栏推荐
- 云上有AI,让地球科学研究更省力
- After working for 10 years, I changed to a programmer. Now I'm 35 + years old and I'm not anxious
- Do you really know the use of idea?
- E-book CHM online CS
- 利用快捷方式-LNK-上线CS
- Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
- Data security -- 13 -- data security lifecycle management
- LeetCode - 152 乘积最大子数组
- SQL Server Manager studio (SSMS) installation tutorial
- Tms320c665x + Xilinx artix7 DSP + FPGA high speed core board
猜你喜欢

论文翻译英译中,怎样做翻译效果好?

接口自动化测试实践指导(上):接口自动化需要做哪些准备工作

Classification des verbes reconstruits grammaticalement - - English Rabbit Learning notes (2)
![[English] Verb Classification of grammatical reconstruction -- English rabbit learning notes (2)](/img/3c/c25e7cbef9be1860842e8981f72352.png)
[English] Verb Classification of grammatical reconstruction -- English rabbit learning notes (2)

基于购买行为数据对超市顾客进行市场细分(RFM模型)

Tms320c665x + Xilinx artix7 DSP + FPGA high speed core board

Financial German translation, a professional translation company in Beijing

Chinese English comparison: you can do this Best of luck

Facebook AI & Oxford proposed a video transformer with "track attention" to perform SOTA in video action recognition tasks

【软件测试进阶第1步】自动化测试基础知识
随机推荐
Pallet management in SAP SD delivery process
My daily learning records / learning methods
成功解决TypeError: data type ‘category‘ not understood
ML之shap:基于adult人口普查收入二分类预测数据集(预测年收入是否超过50k)利用Shap值对XGBoost模型实现可解释性案例之详细攻略
如何做好金融文献翻译?
金融德语翻译,北京专业的翻译公司
删除外部表源数据
Basic commands of MySQL
[English] Grammar remodeling: the core framework of English Learning -- English rabbit learning notes (1)
Cobalt Strike特征修改
LeetCode每日一题(971. Flip Binary Tree To Match Preorder Traversal)
Today's summer solstice
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
基于购买行为数据对超市顾客进行市场细分(RFM模型)
云上有AI,让地球科学研究更省力
UNIPRO Gantt chart "first experience": multi scene exploration behind attention to details
How much is the price for the seal of the certificate
Biomedical English contract translation, characteristics of Vocabulary Translation
Attributeerror: can 't get attribute' sppf 'on < module' models. Common 'from' / home / yolov5 / Models / comm
Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL