Adam’s Law of Redis

No matter how many times you tell everyone to not use KEYS, there remains a non-empty set of people who think they can use KEYS.

You can’t use KEYS because it has to look at every key in the database. Even if you use a prefix pattern to narrow the scope.

Don’t use KEYS. If that means you need to redesign your schema, you have no choice but to redesign your schema.

5 responses to “Adam’s Law of Redis”

  1. This law is not always correct, when building a Redis GUI you _have_ to use KEYS for instance.
    You may be interested by https://github.com/antirez/redis/issues/959

    1. SCAN looks promising! That said, my advice stands: don’t use KEYS on any kind of production server. I, personally, would advise against using any Redis application or GUI that uses the KEYS command.

  2. SCAN looks promising! That said, my advice stands: don’t use KEYS on any kind of production server. I, personally, would advise against using any Redis application or GUI that uses the KEYS command.

  3. All Redis GUI that I know of use **KEYS**, because until **SCAN** is publicly available (2.8) we don’t have any other way to request for **KEYS**.

  4. Yep. Unfortunately, that puts me in the position of discouraging the use of any Redis GUI applications.

    1. Don’t worry with the upcoming SCAN command all of this will look like history for all of us :)

  5. Don’t worry with the upcoming SCAN command all of this will look like history for all of us :)