Replies: 8 comments 1 reply
-
In raw mode. Keys are ordered as rocksdb will order them (just ordered). If you are storing Python string / int / etc., each type of keys are group ordered. However for other objects, since the keys are pickle serialized, the order is uncertain. There is no way to ensure for these keys since calling into Python for comparison would be too slow. |
Beta Was this translation helpful? Give feedback.
-
I do recommend using raw mode for better performance though. |
Beta Was this translation helpful? Give feedback.
-
Thanks. I assume you mean byte order and not insert (time) order. |
Beta Was this translation helpful? Give feedback.
-
Seems like it is nothing one should rely on. |
Beta Was this translation helpful? Give feedback.
-
Right. They are sorted like a treemap. Not like a queue. |
Beta Was this translation helpful? Give feedback.
-
If you need to iterate them according to insertion order. Just make a new column family to map (insert sequence no) -> (key). And then iterate over that column family and fetch the value using the keys. |
Beta Was this translation helpful? Give feedback.
-
Great, thanks for all your input! I was doing some research for a prototype with persistent storage and now settled with https://grantjenks.com/docs/diskcache/ which is really well tested and has many different interfaces, including dict-like (ordered), queue-like and mixed forms. The backend uses sqlite3 though. I wonder what the benefits would be to change the backend to rocksDB instead. DiskCache would be a good baseline for benchmark comparison. |
Beta Was this translation helpful? Give feedback.
-
DiskCache has a dict-like interface named Index, which should be 90 % compatible to RocksDict or builtin dict typical usage. So it should be straightforward to generate some generic benchmarks.
It is just a suggestion since it seems there are plenty of file-based (kv) databases and it may be hard to decide. |
Beta Was this translation helpful? Give feedback.
-
Hi,
starting from Python 3.7, dict() objects guarantee insert order, much like collections.OrderedDict. Is there any order guarantee or possibilities for this library? I didn't find any statement in the docs.
Best
Beta Was this translation helpful? Give feedback.
All reactions