Hi, We’re using badger DB as a key-value store in our blockchain client were, I would like to iterate over a few set of keys rather than iterating over all keys, does badger support any logical grouping (similar to tables in SQL DB’s) ?
If there is no way to distinguish the keys from each other, then you cannot select just them for iteration. You mentioned in your original post:
tables in SQL DB’s
This can absolutely be achieved by adding a prefix to your key. Then to iterate just one “table” you can set the Prefix option on the iterator to that “table” prefix.
Basically, if you have enough information to distinguish what should be in one “table” vs another, you will just want to add that to the beginning of the key. Hashes are tough on their own, and completely negate the usefulness of the prefix features.