当前位置:网站首页>Why doesn't the database use binary tree, red black tree, B tree and hash table? Instead, a b+ tree is used
Why doesn't the database use binary tree, red black tree, B tree and hash table? Instead, a b+ tree is used
2022-06-12 05:57:00 【A little dog】
Why don't databases use binary trees 、 Red and black trees 、B Trees 、Hash surface ? It USES B+ Trees
Binary tree
If you use a binary tree , In the worst case, it will degenerate into a linked list , It's a sequential search , Traverse the entire chain .
When the amount of data is large , The number of layers will increase uncontrollably , It leads to inefficiency .
Red and black trees
Red black tree is a special balanced binary tree , He won't have the worst scenario in a binary tree , He can balance .
But there is also a problem , Because he still belongs to the binary tree , A parent node can only follow 2 Child node . If there are tens of millions of data , Then the red and black trees will be very deep and also need a lot io operation , Such a sentence can not quickly find the data we want .
B Trees
In order to solve the problem of low query efficiency caused by too deep layers of the tree , The space of each node is too small , So increase the node space , Each leaf node stores multiple index elements and corresponding multiple data.
This effectively controls the number of layers , Such a squat tree structure , Less io operation , You only need to find the corresponding leaf node search data that should be entered according to the comparison of non leaf node index elements .
B+ Trees
B There's another problem with trees , Because non leaf nodes are also stored data data , It takes up a lot of space .B+ Non leaf nodes in the tree data Data deletion , Instead, it simply places redundant indexes and corresponding node addresses , In this way, a non leaf node can store more redundant indexes , When looking for , Use binary and half search for the current non leaf node .
And leaf nodes are connected by pointers , Improved interval access performance , Support range lookup .
Each layer is stored in order .

B+ The advantages of trees
- A single non leaf node can store as many index elements + Address , bring IO Reduced operation .
- All searches are for the lowest leaf node , Stable performance lookup .
- And leaf nodes have ordered linked lists , Convenient range search .
Please correct me if there is any mistake
边栏推荐
- Towards End-to-End Lane Detection: an Instance SegmentationApproach
- 网络加速谁更猛?CDN领域再现新王者
- 软件项目架构简单总结
- Identification of campus green plants based on tensorflow
- 将一个文件夹图片分成训练集和测试集
- 为什么联合索引是最左匹配原则?
- BlockingQueue interface introduction
- nrf52832--官方例程ble_app_uart添加led特性,实现电脑uart和手机app控制开发板led开和关
- Beginning is an excellent emlog theme v3.1, which supports emlog Pro
- [untitled]
猜你喜欢

GRP development: four communication modes of GRP

前台展示LED数字(计算器上数字类型)

A month's worth of DDD will help you master it

Chapter 7 - pointer learning

Data integration framework seatunnel learning notes

IO stream introduction

Identification of campus green plants based on tensorflow

Conversion of Halcon 3D depth map to 3D image
![[gin] gin framework for golang web development](/img/15/68c4fd217555f940b3cd3d10fcd54f.jpg)
[gin] gin framework for golang web development
![[PowerShell] command line output and adding system environment variables](/img/49/b92175181aa4a3fddfa3adcacf1d72.jpg)
[PowerShell] command line output and adding system environment variables
随机推荐
Introduction to redis high availability
What is the lszrz protocol used at ordinary times? Talk about xmodem/ymodem/zmodem
Memory model, reference and function supplement of program
肝了一個月的 DDD,一文帶你掌握
Greenplum [question 05] Greenplum streaming server custom client problem handling (increasing)
EBook upload
数据库实验二:数据更新
Multiple ways 99.9% to solve the problem of garbled code after copying text from PDF
[gin] gin framework for golang web development
Jackson - how to convert the array string with only one map object to list < map >
[untitled]
Heap classical problem
Leetcode buckle -10 Regular expression matching analysis [recursion and dynamic programming]
网络加速谁更猛?CDN领域再现新王者
Makefile文件编写快速掌握
China embolic coil market trend report, technical innovation and market forecast
EBook editing and deleting
[JS knowledge] easily understand JS anti shake and throttling
Halcon uses points to fit a plane
Identification of campus green plants based on tensorflow