ZSCAN without scores

Viewed 266

My goal is to iterate the whole sorted set as fast as possible without blocking other operations. I use ZSCAN command for that and here is my question:

Is it possible to remove scores from ZSCAN output? Currently, each 2nd output line is a score and it's necessary to filter it out in my Lua script because I need only keys. Example:

zscan v_ids 0
1) "69632"
2)  1) "88046"
    2) "0.00024987506246876561"
    3) "47792"
    4) "0.00024987506246876561"
    5) "91362"
    6) "0.00024987506246876561"
    ...

P.S. I already reviewed all possible ZSCAN parameters and tried to use other versions of the SCAN command.

1 Answers

It seems there is no such option for ZSCAN. You have to switch to other commands like ZRANGE, ZRANGEBYSCORE, etc. They could limit the returned results by score range or by index, but they might not have the incremental mode and performance as ZSCAN.

Related