当前位置:网站首页>B+ tree height calculation of MySQL
B+ tree height calculation of MySQL
2022-07-28 21:44:00 【Stick stick eat not fat】
problem
hypothesis B+ The height of the tree is 2, The record size of a row of data is 1K, Primary key ID yes int type .
ask : The B+ The total number of records stored in the tree ?
Knowledge point
Mysql The default storage engine for is Innodb
Innodb The minimum storage unit of is page
One page is equal to 16K
B+ The leaf nodes of the tree are stored data , Internal node storage Key value and pointer
At a height of 2 Of B+ Tree case ,
B+ The tree stores the total record = The number of record lines of a single leaf node * Number of root node pointers
To solve the process
1) Calculate the number of record lines of a single leaf node
The size of a single page is 16K
The size of a row of data is 1K
So the number of lines =16K / 1K =16
2) Calculate the number of root node pointers
One int The character length of type is 4 byte
stay Innodb The length of a pointer in the setting is 4 byte
total 8 Bytes
So the number of root node pointers =16KB / 8B = 16 * 1024B / 8B = 2048
According to the formula :B+ The tree stores the total record =2048 * 16 = 32768
in summary : The height is 2 And meet the above conditions B+ Trees store records 32768 strip
Additional explanation :
If B+ The height of the tree is 3,B+ The tree storage record is
2048 * 2048 * 16 = 67108864
thus it can be seen ,B+ The height of the tree exceeds 3 when , disk IO Rapid increase ,SQL Query pressure will also increase dramatically .
边栏推荐
- 30. Learn highcharts label rotation histogram
- Four methods of multi-threaded sequential operation. Ask casually during the interview
- 职场高薪 |「中高级测试」面试题
- 中国农业工程学会农业水土工程专业委员会-第十二届-笔记
- 1162. Map analysis - non recursive method
- 云安全核心技术
- What is the purpose of database read-write separation [easy to understand]
- C语言入门【详细】
- Week 6 Linear Models for Classification (Part B)
- Construction of Chinese traditional embroidery classification model based on xception TD
猜你喜欢

入行4年,跳槽2次,我摸透了软件测试这一行~

实现瀑布流效果

网格数据生成函数meshgrid

LT7911D Type-C/DP转mipi 方案成熟可提供技术支持

Information fusion method and application of expert opinion and trust in large group emergency decision-making based on complex network

MySQL 是如何归档数据的呢?

顺序表的实现

Meta opens the project aria pilot dataset and will develop real-time 3D maps in the future

Icml2022 | timing self-monitoring video transformer
![Leetcode 19. delete the penultimate node of the linked list [knowledge points: speed pointer, recursion, stack]](/img/86/c74a63c3465efbed74c2bf059bac4f.jpg)
Leetcode 19. delete the penultimate node of the linked list [knowledge points: speed pointer, recursion, stack]
随机推荐
Attribute based encryption simulation and code implementation (cp-abe) paper: ciphertext policy attribute based encryption
数据库读写分离目的是做什么[通俗易懂]
An end-to-end aspect level emotion analysis method for government app reviews based on brnn
顶级“Redis 笔记”, 缓存雪崩 + 击穿 + 穿透 + 集群 + 分布式锁,NB 了
Adventures of little mouse: behind the scenes gags of moss 2
Kubeadm搭建kubernetes集群
将字符串指针赋值给数组[通俗易懂]
Discussion: if you want to land Devops, is it enough to only consider a good PAAS container platform?
The ref value ‘xxx‘ will likely have changed by the time this effect function runs. If this ref......
How Oracle exports data (how Oracle backs up databases)
Leetcode linked list problem -- 142. circular linked list II (learn the linked list by one question and one article)
30. Learn highcharts label rotation histogram
MATLAB从入门到精通 第1章 MATLAB入门
世界肝炎日 | 基层也能享受三甲资源,智慧医疗系统如何解决“看病难”?
入行4年,跳槽2次,我摸透了软件测试这一行~
8、 QoS queue scheduling and message discarding
酷派主动终止针对小米公司的专利侵权诉讼
Leetcode linked list question - interview question 02.07. linked list intersection (learn linked list by one question and one article)
LeetCode链表问题——142.环形链表II(一题一文学会链表)
ABB electromagnetic flowmeter maintenance signal transmitter maintenance 41f/e4 technical parameters