当前位置:网站首页>【HBZ分享】Mysql的InnoDB原理
【HBZ分享】Mysql的InnoDB原理
2022-06-29 10:29:00 【hbz-】
没有配置主键时Mysql的InnoDB是如何做的?
- Mysql会使用自带的rowid作为主键
InnoDB的底层数据结构是什么?
- B+Tree
BTree的特点(MyISAM)
- 非聚集索引,即【索引】和【对应数据】是分开的两个文件。
- 找到对应数据后,节点的key下面带有数据的data,是一个16进制的,这个data就标识着该key的内容在数据文件中对应的位置,然后会拿着这个16进制的data去数据文件找对应的数据
B+Tree的特点(InnoDB)
- 聚集索引,即【索引】和【对应数据】是在一起的,在一个文件中
- 通过索引找到对应key后,这条数据的内容其实和key是在一起的,直接取回数据即可,无需再拿着data去另一个文件找,这就是有点
- B+Tree的叶子节点的key,即主键id是有序的,从小到达排列的,也就是对范围查找又很大的好处
- 范围查找,比如id > 15, 即叶子key=15后面的所有数据都是要的,因为id是由顺序排列的,15后面的节点,一定都是大于15的
为什么InnoDB引擎需要主键,并且推荐使用整数?
- B+Tree底层可能会做一些值比较大小的操作,这个时候整数就突显优势了,比如id > 15.
- 如果不使用整数,而用uuid,如果后期用到范围查询,那只能通过时间了,不能通过主键id
边栏推荐
- 中国计算语言学大会、全国知识图谱与语义计算大会赛题火热进行中
- 通过网上进行股票开户安全吗
- Encore une fois, le chemin de l'amélioration de redis Cloud
- (JS) imitate the indexof method to find the position of a character in the string
- Nuc980 started successfully
- csdn涨薪秘籍之腾讯自动化软件测试面试题(含答案)
- Multithreaded high concurrency server: three problems
- 在编写shell脚本时如何正确姿势地管理临时文件
- (JS) status mode
- what? It's amazing that you can read the whole comic book for free. You can't learn to be a money saver together
猜你喜欢
![[digital signal modulation] realize signal modulation and demodulation based on am+fm+dsb+ssb, including Matlab source code](/img/76/bcf0118c8eea2b45b47eda4a68d3fd.png)
[digital signal modulation] realize signal modulation and demodulation based on am+fm+dsb+ssb, including Matlab source code

斐波那锲数列与冒泡排序法在C语言中的用法

The first "cyborg" in the world died, and he only transformed himself to "change his life against the sky"

Bs-gx-017 online examination management system based on SSM

如何识别出轮廓准确的长和宽

Take another picture of cloud redis' improvement path

Specific method and example program of Siemens s7-200smart control stepping motor

又拍雲 Redis 的改進之路

Limit introduction summary

极限导论总结
随机推荐
(JS) observer mode
又拍云 Redis 的改进之路
EasyDSS部署在C盘,录像回看无法正常播放该如何解决?
关于IP定位查询接口的测评Ⅱ
Thoroughly understand JVM Series 7: what is the flow process of objects in the generational model?
csdn涨薪秘籍之腾讯自动化软件测试面试题(含答案)
Spark - Task 与 Partition 一一对应与参数详解
微博评论架构设计
Add notification announcements to send notifications to online users
【每日3题(2)】生成交替二进制字符串的最少操作数
TTL串口学习型红外遥控模块可扩展成网络控制
When the "Ai x scientific computing" is in progress, Huawei's mindspore competition question is hot, waiting for you!
(JS) pure function in array
(JS)捕获错误(异常)
Xuetong denies that the theft of QQ number is related to it: it has been reported; IPhone 14 is ready for mass production: four models are launched simultaneously; Simple and elegant software has long
(JS)数组方法:slice和splice
misc3~7
在线SQL转HTMLTable工具
Graduation season · advanced technology Er - workers in the workplace
(JS) iterator mode