Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing nodes when they are underoccupied #2

Open
mr-bat opened this issue May 5, 2019 · 5 comments
Open

Removing nodes when they are underoccupied #2

mr-bat opened this issue May 5, 2019 · 5 comments

Comments

@mr-bat
Copy link

mr-bat commented May 5, 2019

Why don't you remove unnecessary nodes when they become under-occupied? How are you going to deal with a large number of useless branch nodes in tree?

@myui
Copy link
Owner

myui commented May 18, 2019

@mr-bat I just noticed your comment. Sorry to be late.

It's because prefix b+tree requires a special case for deletion. Unlike general b+-tree, prefix b+-tree stores shortest possible separator as see in https://github.com/myui/btree4j/blob/master/src/main/java/btree4j/BTree.java#L802

Then, even if a key is deleted, it's hard to determine while the intermediate seperator(s) in branch nodes can be deleted or not.

@myui
Copy link
Owner

myui commented May 18, 2019

But as described in the paper, delete can be implemented with a careful implementation.
No merge feature (merging small leaves and branch shrinking) since my original motivation was append-only usecase.

Better to implement it for delete-heavy workloads.

@plummip
Copy link

plummip commented Aug 18, 2020

Could you explain a bit how we approach this situation?
I tryed implementing it without any luck.
-merge neighbour nodes that share the same parent
-set left/right
-remove parent separator
[if > 0 keys] -recalculate parent separator
[else] -point parent-parent to node & remove parent node

@myui
Copy link
Owner

myui commented Aug 19, 2020

@mr-bat
Copy link
Author

mr-bat commented Aug 19, 2020

You can also look at this project https://github.com/mr-bat/BPlusTree.
I ended up implementing a B+ tree of my own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants