ERM

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Delete keys by key_pattern

Usage: ERM key*
Output: number of deleted keys, e.g. 10
❗Use this command to delete a large number of keys with a key_pattern such as 'key*'.
    And specify a data_type such as string/list/set whenever possible.
    To delete a single key, use the 'DEL' command.
📍Delete count limit: limited by redis.conf ll_max 10000.
📍Why the limit: if there are very many keys (e.g. 10 million or more) and there is no limit, other commands cannot run while this command runs, which can be a problem on production servers.
The default ll_max is 10000. You can change it at runtime with CONFIG SET if needed.
💻 If the number of keys to delete is greater than or equal to ll_max, you can repeat the command. Example) erm key* -> if there are 50,000 key* keys, run erm key* 5 times. This is similar to repeating SCAN to iterate.
💻 Specifying a data type is useful. Example) "erm key* string" or "erm * string"
From Ent 8.1.0, data is stored separately by data type, so the whole key table is not scanned.

Example

Command>erm key* string     ℹ️ Delete string keys matching the key_pattern
Result>(integer) 12
Command>erm * list     ℹ️ Delete all list keys
Result>(integer) 44


Syntax

ERM key_pattern [data_type]

  • Available since Ent 8.1.0.
  • Time complexity is O(N).

<< ELL ERM LOLWUT >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.