Discussion about this post

User's avatar
noobengineer's avatar

Thanks for the great article 👍

For The section:

However, B+trees have a linked list of leaf nodes. Thus, you can just use one path to traverse down the whole tree and then access all the keys using links at the leaf nodes. Thus, making sequential access more efficient in case of B+Trees.

My question is:

How is the B+ tree read sequential on disc (assuming HDD)?

From your example, I believe the leaf nodes 1,3,4,5,6,10,12... are not stored in sequential pages on disc. The reason is because otherwise, as soon as you add a new node , say 7, you will have to move all pages after that (10,12...) which will become an extremely expensive operation.

When I read "sequential", I believe the context should be sequential disc read (in context of a hard disc, for SSDs, it doesn't matter).

So, even though each leaf node is pointing to the next leaf node, it will be a random disc access.

Expand full comment
Navin Bhandari's avatar

Really good read!!

Expand full comment
7 more comments...

No posts