pengkobe / reading-notes

:stars: to record daily reading notes. I build an issue blog to record daily FE study notes. suggestion and comments are welcomed.
https://github.com/pengkobe/reading-notes/issues
MIT License
13 stars 1 forks source link

数据库索引用的是啥数据结构 #487

Open pengkobe opened 5 years ago

pengkobe commented 5 years ago

数据库索引,是数据库管理系统中一个排序的数据结构,以协助快速查询、更新数据库表中数据。索引的实现通常使用 B 树及其变种 B+ 树。

优点

缺点

使用场景

优化数据量较大查询频繁的场景

数据结构

B 树

查询是不一定要走完整棵树,值可能在路径上的任何一个位置,找到了就可以停止。但是,删除和更新就不那么方便了。

B- 树

值总是位于叶子节点上,叶子直接通过一定的顺序链接起来,因为,删除和更新比较方便,查询则必须走完整棵树。