首页 > 其他 > 详细

What is the difference between btree and rtree indexing?

时间:2020-01-20 21:13:57      阅读:87      评论:0      收藏:0      [点我收藏+]

https://softwareengineering.stackexchange.com/questions/113256/what-is-the-difference-between-btree-and-rtree-indexing

52
 

BTree

BTree (in fact B*Tree) is an efficient ordered key-value map. Meaning:

  • given the key, a BTree index can quickly find a record,
  • a BTree can be scanned in order.
  • it‘s also easy to fetch all the keys (and records) within a range.

e.g. "all events between 9am and 5pm", "last names starting with ‘R‘"

RTree

RTree is a spatial index which means that it can quickly identify close values in 2 or more dimensions. It‘s used in geographic databases for queries such as:

all points within X meters from (x,y)

Hash

Hash is an unordered key-value map. It‘s even more efficient than a BTree: O(1) instead of O(log n).

But it doesn‘t have any concept of order so it can‘t be used for sort operations or to fetch ranges.

As a side note, originally, MySQL only allowed Hash indexes on MEMORY tables; but I‘m not sure if that has been changed over the years.

 

 

 

What is the difference between btree and rtree indexing?

原文:https://www.cnblogs.com/yuanjiangw/p/12219216.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!