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

Use Sparse Bitmaps #3

Open
tomijaga opened this issue Dec 12, 2024 · 0 comments
Open

Use Sparse Bitmaps #3

tomijaga opened this issue Dec 12, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@tomijaga
Copy link
Member

tomijaga commented Dec 12, 2024

Changes to make

Update the bitmap implementation to include a sparse bitmap that uses the roaring bitmap compression

Why We need this change?

Our index scans return a range of ids which are often not in order and have holes in them. These ids are loaded into a bitmap to perform set operations. But due to the way the general bitmap works it wastes space allocating memory for all elements between 0 and the largest id in the range even though if they not present in the id range.

Consider an index scan that returns the range (10_000_000, 10_000_005).
The current bitmap implementation will allocate space for every value from 0 to 10_000_005 and only set the last 5 elements to true, wasting space for the 10 million elements elements in between.

The sparse bitmap implementation will avoid allocating space for those 10 million ids. Which would in turn reduce our memory usage and wasm instructions, and result in faster queries.

@tomijaga tomijaga added the enhancement New feature or request label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant