Is there an efficient way to iterate over the members of a LIST in LUA without loading them all into memory? I assume LRANGE would load them all into memory while LINDEX would become slow as I incremented the index counter.
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Redis DB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/redis-db/oXOcPBxHvN0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to redis-db+u...@googlegroups.com.
Thanks Nils, but I'm guessing that won't be super efficient for a large list. I assume the LIST is stored internally as a linked list. As a result, to get a range that doesn't not start's at N, REDIS has to iterate through the list to get to N giving it O(N) performance. It's a shame there is no construct with LUA to just iterate through the links.
On Sep 2, 2014, at 1:55 PM, Robert DiFalco <robert....@gmail.com> wrote:
> Thanks Nils, but I'm guessing that won't be super efficient for a large list. I assume the LIST is stored internally as a linked list. As a result, to get a range that doesn't not start's at N, REDIS has to iterate through the list to get to N giving it O(N) performance. It's a shame there is no construct with LUA to just iterate through the links.
See the Circular List section of http://redis.io/commands/rpoplpush -- "a client can visit all the elements of an N-elements list, one after the other, inO(N) without transferring the full list from the server to the client using a single LRANGE operation."
-Matt