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
Feature request: check if prefix exists without seeking #12396
Comments
@ajkr I wanted to get your opinion on this, does this sound like it's doable? Will it make a big difference like I expect? And in terms of complexity, is it a simple thing I can do with some directions/pointers from you or does it require more deep level of how rocksdb works? |
It's a good question. The core of the issue sounds familiar. Users want ways to prevent lookups from searching older LSM components when they already got what they need. I will need to think about it more. Coming up with a good API for this may be challenging. Here are a couple use cases we heard about recently that felt like the same core issue. I dealt with such a case yesterday in #12438. Actually, that user would have preferred an iterator interface, but currently the iterator does not support returning unmerged operands it finds ( There was also a question last week: for a SQL query like |
I remembered @pdillinger's proposal in #11644. Assuming it supports the limit options ("There would likely be limit options on number of keys and value size"), for your use case you could call the hypothetical The
I think it's difficult. The whole iterator hierarchy today uses key order; it doesn't consider LSM component order at all for point keys. Once you introduce LSM component order, there are all sorts of challenges. For example, how to tell if keys were overwritten or deleted in an earlier component that you already processed a while ago. Or how to deal with merge operands - one key's merge operands may be spread over multiple LSM components but all are needed to obtain the value. |
got it, this makes sense, and thanks for the insight. The |
Sure, if you agree the |
Currently, my service is performing thousands of prefix matches per second to check if a given prefix matches any key in a cf/db. The current approach I'm using is to do a seek to the prefix and if found then return true otherwise return false.
My setup is as follows:
say my key format is:
<uid>:<some dynamic value>
my prefix extractor is setup to extract the
<uid>
my prefix exists check are in the form of:
<uid>:<some prefix>
so while i always have the uid and I am benefiting from the prefix extractor/prefix bloom. I still have to seek to to check if there exists a key that starts with this prefixthe feature request:
instead of seeking to the first key that matches the prefix being searched, we stop searching once we find any key that matches the prefix being searched for.
The text was updated successfully, but these errors were encountered: