4 ms·
Agree completely, this is not where I want Redis should go, I was just tinkeing with the idea. Antirez: are you considering a Sorted Map of some kind with a wa
by gtrubetskoy 14y ago
Agree completely, this is not where I want Redis should go, I was just tinkeing with the idea.
Antirez: are you considering a Sorted Map of some kind with a way to iterate over it? (ZSET is almost it, but semantics are a little different and Redis does not have iterators, at least not exposed to the protocol). With SQLite4 a Redis Cluster with such a type could serve as the underlying storage engine, basically creating an infinitely scalable database.
BTW - kudos on Redis, I LOVE the clean C code. I must note that in the process of hacking on Thredis I couldn't help noticing there are many "cultural" similarities between SQLite and Redis, e.g. fondness of Tcl, integers as strings, etc.
- blibble 14y agoyou can make your own iterator over sorted sets pretty easily with zrange
- gtrubetskoy 14y agoTrue, but not quite. The first thing zrange does is look for the starting point, which is an approximately O(log(N)) for a skiplist (which is how it's implemented). An iterator's next() operation should be O(1). If I need to iterate over a gazillion elements, it would make a huge difference. Or course you could zrange chunks, and it would be more efficient, but what's wrong with a simple START and NEXT semantic? BUT this is all a moot point - a Sorted Set is not the type of structure that something like SQLite4 needs anyway. The keys should be sorted lexicographically, not by score. I think a Skip List fits the bill perfectly, and Redis already contains an implementation of it (as part of Sorted Sets), why not expose it as a standalone type?
- deleted 14y ago[deleted]