-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Adding delta compression to Bitpacking compression #5491
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this is used to prevent weird issues when trying max from limits.h
samansmink
changed the title
Bitpacking refactor
Adding delta compression to Bitpacking compression
Nov 25, 2022
Mytherin
reviewed
Nov 30, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Great work and great results! Some comments below:
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR reworks our bitpacking compression implementation, main improvements:
The current implementation chooses for each
VECTOR_SIZE
values the most suitable compression mode.In the process I also improved the
NumericLimits
class a bit by making it theMinimum
andMaximum
methods constexpr.Compression ratio
TPC-DS SF1 gets roughly 10% smaller from 317992960 to 288108544 bytes.
TPC-H SF1 gets roughly 3% smaller from 264777728 to 256651264 bytes.
Compression ratio validation is in
test/sql/storage/compression/bitpacking/bitpacking_compression_ratio.test_coverage
. Max compression ratio is like ~800x-900x for constant compression or constant delta compression, delta_for and for can compress up to ~58x-60x.Performance
Ran some benchmarks on my M1 macbook to validate the implementation.
Firstly added some benchmarks to
benchmark/micro/compression
to target the different modes:then tpch write:
Read performance did not change much, bitpacking is already very fast. Adding delta on top doesn't really change much. Write performance has improved quite a bit due to our previous inefficient use of TrySubtractOperator that is now both changed to constexpr and called less often.
Future improvements
Some ideas that are left for future improvements, they're not super important i think: