Repository navigation
Conversation
|
cc @rschu1ze -- I think this one still needs approval to run tests |
|
Workflow [PR], commit [768ffc7] Summary: ❌
|
|
I added the |
|
Hi @fastio You are back on board :), thanks!! I see that there are a few small issues in the CI. Once solved I will review all the changes all together in a first iteration as usual. |
Hi @Ergus , thanks!! Happy to be back 😄 |
| - `none` - the posting lists are stored without additional compression. | ||
| - `bitpacking` - apply [differential (delta) coding](https://en.wikipedia.org/wiki/Delta_encoding), followed by [bit-packing](https://dev.to/madhav_baby_giraffe/bit-packing-the-secret-to-optimizing-data-storage-and-transmission-m70) (each within blocks of fixed-size). Slows down SELECT queries and is not recommended at the moment. | ||
|
|
||
| Optional parameter `posting_list_apply_mode` (default: `lazy`) specifies how compressed posting lists are decoded and applied during query execution. This parameter is only effective when `posting_list_codec` is set to a compressed codec (e.g., `bitpacking`): |
There was a problem hiding this comment.
Why does posting_list_apply_mode need to be an index parameter? Can it not be a normal session setting?
There was a problem hiding this comment.
It can indeed be made into a session-level setting.
If apply_mode='lazy' is enabled, then during posting list compression we need to write block-level metadata such as the offset and the max row id.
There was a problem hiding this comment.
Thoughts:
- we should avoid having two different persistence formats in the first place. This would cause too much complexity for too little benefit.
- if lazy reading needs extra metadata, then let's just add it to the persistence format - I didn't read the code yet but I assume it is negligibly small in comparison to the rest of the posting lists
- note that we'll need to increment the index version (see
enum class SparseIndexVersion) whenever we change the persistence format after 26.2 (this is when the text index is planned to be made GA)
There was a problem hiding this comment.
Hi @rschu1ze , Thanks for the feedback — I’ll think it through and reorganize the code accordingly.
|
Hi @fastio I have been checking this performance improvement but I don't get any clear performance improvement. Do you have some specific cases where I can notice some performance improvement? At least some select queries where time improves end-to-end? If the performance improvement is not significant maybe we can/should consider some other optimizations instead of this. |
768ffc7 to
b4ac574
Compare
|
Hi @fastio Any reason why you closed this PR? Do you need any help? |
Hi @Ergus, It looks like I accidentally deleted the branch associated with this PR while cleaning up my repository. I'm converting it to draft for now. I've validated the optimization on a separate branch and it's working |
|
I'm converting this to draft for now and will reopen it once it's ready. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
posting_list_apply_modeparameter. The newlazymode uses cursor-based iteration with skip-list algorithms for efficient intersection/union operations, avoiding full decompression. This significantly reduces memory usage and latency for selective queries involving many posting lists.Documentation entry for user-facing changes
Motivation:
In the current implementation, compressed posting lists must first be decompressed and then materialized into Roaring Bitmaps before AND/OR operations can be applied. Building Roaring Bitmaps is expensive, and the cost scales roughly proportionally to the number of posting lists involved. Therefore, queries involving a large number of posting lists suffer from noticeable latency due to this bitmap construction overhead.
This PR optimizes the execution path by bypassing the Roaring Bitmap construction phase. Instead of materializing each decompressed posting list into a Roaring Bitmap, we directly build the final AND/OR result during decompression, eliminating the per-posting-list bitmap construction cost.
Parameters
The details of posting_list_apply_mode:
Uses cursor-based iteration for on-demand decoding
Employs skip-list algorithms for efficient intersection/union operations
Avoids full decompression, resulting in lower memory usage
Best for selective queries (e.g., hasAllTokens with rare tokens)
Note: When using lazy mode, codec cannot be none
Fully decompresses posting lists into Roaring Bitmaps before set operations
May be faster for queries accessing most posting list entries (e.g., dense token unions)
Example use
Note
Low Risk
Low risk because the provided diff contains no modifications to code or configuration.
Overview
The provided diff contains no file or code changes (it only shows
+++ /dev/nullwith no associated hunks), so there is nothing to review for functional impact.Written by Cursor Bugbot for commit b4ac574. This will update automatically on new commits. Configure here.