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

Optimize Hash Index slot splitting #3325

Merged
merged 1 commit into from
Apr 19, 2024
Merged

Optimize Hash Index slot splitting #3325

merged 1 commit into from
Apr 19, 2024

Conversation

benjaminwinger
Copy link
Collaborator

As referenced in #3298 , the rehashSlots method (now merged with splitSlot into splitSlots) had not been optimized for bulk splitting, which was bottlenecking the performance of multiple copies. This removes that bottleneck, improving the performance of the second copy to ~2.8x the cost of the first (when they are the same size that is).

It was necessary to remove the locking on the disk array WriteIterator so that multiple can be used on different pages at the same time (the original slot and new slot in this case). Overflow slots are more complicated, and since we can generally assume there are relatively few of them I made it cache new overflow slots in memory and append them at the end so that it's not necessary to juggle two different slot pointers and iterators which can't overlap at the risk of invalidating the other slot pointer and needing to track which iterator is used for which slot at any given time.
To avoid a similar issue with primary slots, I made the minimum number of primary slots allocated the first time be 16 (one full page of slots) so that the original slot and the new slot are never on the same page when splitting.

src/storage/index/in_mem_hash_index.cpp Outdated Show resolved Hide resolved
src/storage/storage_structure/disk_array.cpp Show resolved Hide resolved
@benjaminwinger benjaminwinger merged commit 4917262 into master Apr 19, 2024
17 checks passed
@benjaminwinger benjaminwinger deleted the rehash-opt branch April 19, 2024 20:00
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

Successfully merging this pull request may close these issues.

None yet

2 participants