Why not B+-Tree MongoDB

b-tree, geospatial, mongodb, spatial-index

Solution

The question has confused me when I learned B/B+.Now I get some answers:

- mysql is a relational db, while mongo isn't. It means that we do more range operations in mysql(such as `select * from xx where id > 23`). So the advantages of B+ tree aren't obvious.

- B tree's best search time is O(1), while B+ is always O(log n). So when search some 'hot' data. B tree has a better performance.(however if you always search the data in the leaf when using B tree, it takes more disk IO times so it may not perform well.)

In my opinion, it depends on the details how mongo implements.But I am not a Mongo developer. :D

Problem

Do anyone know why MongoDB use B-Tree but not B+-Tree? As I know most DBMS use B+-Tree. Are there any special reason for MongoDB to use B-Tree? thanks.

Original source