当前位置:网站首页>BTREE, B + tree and hash index
BTREE, B + tree and hash index
2022-04-23 07:42:00 【0zien0】
hash Index is characterized by high retrieval efficiency , Search once to locate ,BTree You need to look down from the root node , After many times IO Visit to find the results , therefore hash Indexing is much more efficient than BTree.
but hash It also has many limitations and defects :
1.hash The target can only be accurately located by index , Instead of range query .
2. because hash Only the past is saved hash After calculation hash Value and corresponding line pointer , So it can't be used for sorting .
3.hash If the index encounters a large number of hash Equal values , Then a large amount of record pointer information will be stored in the same hash Value up , In this way, it will be troublesome to locate a record , The final efficiency is not necessarily better than BTree High index .
4. For composite indexes ,hash The index will combine the combined indexes and then calculate hash value , Instead of calculating separately hash value , So by combining the first several index key values of the index ,hash The index cannot be used .
5. Because different index keys may have the same hash value , therefore hash The index cannot avoid full table scanning at any time .
BTree Also called balanced multiple search tree . A tree m Step B Trees (m Fork tree ) Its characteristics are as follows :
1. Each node in the tree contains at most m A child (m>=2);
2. Except for root and leaf nodes , Every other node has at least [ceil(m / 2)] A child ( among ceil(x) It's a function with an upper bound );
3. If the root node is not a leaf node , At least 2 A child ( A special case : No child's roots , That is, the root node is the leaf node , The whole tree has only one root node );
4. All leaf nodes appear in the same layer , Leaf node does not contain any keyword information
5. Each non terminal node contains n Keyword information (P0,P1,…Pn, k1,…kn)
6. Number of keywords n Satisfy :ceil(m/2)-1 <= n <= m-1
7. ki(i=1,…n) Keyword , And the keywords are sorted in ascending order .
8. Pi(i=1,…n) Is the pointer to the root node of the subtree .P(i-1) All node keywords of the pointed subtree are less than ki, But they are greater than k(i-1)

B+Tree Is in BTree An optimization based on .
1. Non leaf nodes only store key information . This can greatly increase the storage capacity of each node key Value quantity , Reduce B+Tree Height .
2. There is a chain pointer between all leaf nodes . Traversal is more convenient .
3. Data records are stored in leaf nodes .

Reference material :
Contains a binary tree 、 Balanced binary trees 、 Balance multiple search trees (BTree)
https://blog.csdn.net/hao65103940/article/details/89032538
版权声明
本文为[0zien0]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230623293861.html
边栏推荐
- Nacos / sentinel gateway current limiting and grouping (code)
- 基于可视化结构的身份证号码校验系统-树莓派实现
- [Ted series] how to get along with inner critics?
- 获取字符格式的当前时间
- redis连接出错 ERR AUTH <password> called without any password configured for the default user.
- 游戏辅助脚本开发之旅
- P2257 YY的GCD(莫比乌斯反演)
- 13.用户和权限管理
- Solutions to common problems in visualization (VII) solutions to drawing scale setting
- 8. Paging query
猜你喜欢

Nacos/sentinel网关限流和分组 (代码)

数据分析入门 | kaggle泰坦尼克任务(四)—>数据清洗及特征处理

自定义时间格式(YYYY-MM-DD HH:mm:ss 星期X)

反思 | Android 音视频缓存机制的系统性设计

Mysql 数据库从设计上的优化

菜菜的并发编程笔记 |(九)异步IO实现并发爬虫加速

菜菜的刷题日记 | 238.除自身以外数组的乘积

Background management system framework, there is always what you want

Authorization server (simple construction of authorization server)

SAP TRANSLATE使用数据对象掩码示例
随机推荐
VScode
每日一题 | 曾被反转链表支配的恐惧
The difference between null and undefined
数论之拓展欧几里得
Mysql持久性的实现
Javscript gets the real suffix of the file
9. Common functions
数据分析入门 | kaggle泰坦尼克任务(四)—>数据清洗及特征处理
8.分页查询
1D/1D动态规划学习总结
[COCI] Vještica (子集dp)
7. sub query
14. Transaction processing
h5本地存储数据sessionStorage、localStorage
SAP PI/PO rfc2Soap 发布rfc接口为ws示例
vim+ctags+cscpope开发环境搭建指南
Transformer的pytorch实现
快速下载vscode的方法
Date对象(js内置对象)
Pycharm