SCAN over KEYS

Difficulty: Intermediate

Question

Why should you use SCAN instead of KEYS in production?

Answer

`KEYS` can block the server for a long time if there are millions of keys. `SCAN` is a non-blocking cursor-based iterator.

Concepts covered

Performance, Iteration